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
Super User
Super User

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 II
Super User II

@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
Super User
Super User

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

@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.

Glad that worked out for you.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (2,246)