cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
roast1980
Frequent Visitor

Update SharePoint display name

Hi all

 

I have a field called Hiring Manager that is shown in an email as Smith, John, I would like to show it as John Smith.

 

Thanks

KC

1 ACCEPTED SOLUTION

Accepted Solutions
Amanthaper
Responsive Resident
Responsive Resident

Hi, you can use various functions to achieve this.

PAUG_stringfun.png

The functions are:

Example1:

Exp1: substring(triggerBody()['text'],add(2,int(indexOf(triggerBody()['text'],','))),sub(int(length(triggerBody()['text'])),add(2,int(indexOf(triggerBody()['text'],',')))))

Exp2: substring(triggerBody()['text'],0,Sub(int(length(triggerBody()['text'])), sub(int(length(triggerBody()['text'])),int(indexOf(triggerBody()['text'],',')))))

Note the space between the 2.

Example 2 (all-in-one):

concat(concat(substring(triggerBody()['text'],add(2,int(indexOf(triggerBody()['text'],','))),sub(int(length(triggerBody()['text'])),add(2,int(indexOf(triggerBody()['text'],','))))),' '),substring(triggerBody()['text'],0,Sub(int(length(triggerBody()['text'])), sub(int(length(triggerBody()['text'])),int(indexOf(triggerBody()['text'],','))))))

 

Of course the correct formatting depends on the data being exactly formatted as you've described. Garbage in - garbage out.

 

Cheers,

Aman

 

------------------------------------------------------------------------------------------------------
If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
------------------------------------------------------------------------------------------------------

View solution in original post

7 REPLIES 7
Hardesh15
Super User
Super User

@roast1980 

 

Please Share your flow Screen so thatwe can see your Email field.

 

Thanks

Hardesh

roast1980_0-1601920128942.png

 

This is the details part from the approval flow, where is says Hiring Manager is a field from SharePoint, I'd like to add an expression to convert the string "Smith, John" to "John Smith".  In Excel I would use right, left & find etc - what's the best way to do this in Power Automate.

 

Thanks

KC

 

@roast1980 

 

How your organization store data for user? It is in this format- "last name, first name". Can you check display name in Get User Profile" action.

There is way to deal with it. You can manipulate string with split function and then colect first and last name in string variable which you can concat later. Please check display name of get user profile in compose action .

Thanks

Hardesh

Amanthaper
Responsive Resident
Responsive Resident

Hi, you can use various functions to achieve this.

PAUG_stringfun.png

The functions are:

Example1:

Exp1: substring(triggerBody()['text'],add(2,int(indexOf(triggerBody()['text'],','))),sub(int(length(triggerBody()['text'])),add(2,int(indexOf(triggerBody()['text'],',')))))

Exp2: substring(triggerBody()['text'],0,Sub(int(length(triggerBody()['text'])), sub(int(length(triggerBody()['text'])),int(indexOf(triggerBody()['text'],',')))))

Note the space between the 2.

Example 2 (all-in-one):

concat(concat(substring(triggerBody()['text'],add(2,int(indexOf(triggerBody()['text'],','))),sub(int(length(triggerBody()['text'])),add(2,int(indexOf(triggerBody()['text'],','))))),' '),substring(triggerBody()['text'],0,Sub(int(length(triggerBody()['text'])), sub(int(length(triggerBody()['text'])),int(indexOf(triggerBody()['text'],','))))))

 

Of course the correct formatting depends on the data being exactly formatted as you've described. Garbage in - garbage out.

 

Cheers,

Aman

 

------------------------------------------------------------------------------------------------------
If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
------------------------------------------------------------------------------------------------------

@Amanthaper 

 

Requesting you pls do not jump in between to any post. If you have any problem in content then you can share your opinion.

 

It is common practice in community. 

 

Thanks

Hardesh

Thanks @Amanthaper 

 

I used the 2nd one and it worked a treat.

 

Thanks also @Hardesh15 for your input.

Amanthaper
Responsive Resident
Responsive Resident

Glad that worked out for you.

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

AI Builder AMA June 7th carousel (up on May 25th, take down June 8th) (1).png

'Ask Microsoft Anything' about AI Builder!

The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.

Users online (2,172)