web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Split SharePoint Perso...
Power Automate
Answered

Split SharePoint Person or Group Column Display Name

(0) ShareShare
ReportReport
Posted on by 149

Hi Guys,

 

I'm hoping someone can help with a problem I'm having re-formatting the display name in a SharePoint Person or Group column from 'Last Name, First Name (Company Name)' to 'First Name Last Name'. I've got a flow working that re-formats it to 'First Name (Company Name) Last Name' but I'm pretty inexperienced with Power Automate and can't figure out how to remove the (Company Name) element.

 

As an example, the display name format starts as Smith, John (Company Name) and I need it to end up as John Smith. To make it slightly more complicated, not every display name in the SharePoint list contains the (Company Name) element.

 

My current flow is as follows:

 

Screenshot 2023-08-22 095557.png    

The Condition expression is: 

empty(triggerBody()?['Requestor']?['DisplayName'])

 The first Compose expression is:

first(split(triggerbody()?['Requestor']?['DisplayName'],', '))

The second Compose expression is:

last(split(triggerbody()?['Requestor']?['DisplayName'],', '))

 

If someone could help me finish this off by removing the (Company Name) element it would be much appreciated.    

Categories:
I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Low_Flying_Bird,

     

    In the second compose you can use another split on the '(' character.

     

    Can you try the below for the second compose?

    This sample assumes it always has company name in the first name. If that is not the case you would have to check this with an indexof function instead.

     

     

    first(split(last(split(triggerbody()?['Requestor']?['DisplayName'],', ')), ' ('))

     

     

  • Matt-991599 Profile Picture
    149 on at

    Hi Expiscornovus,


    You are a superstar my friend! That worked perfectly ... and irrespective of whether the display name included the (company name) element or not. Thanks so much for your help.

    Just one other quick thing - I may have something else slightly wrong in my flow because although I'm using the 'Get Item' action, it seems to be updating every item in the list each time it runs.  Can I tweak my flow somehow so it only updates the individual item that has been creted or modified?

    Thanks

  • Matt-991599 Profile Picture
    149 on at

    Further to my last reply Expiscornovus, I just noticed one other small issue.

    If I delete a name from the 'Requestor' column, it doesn't clear the 'Single line of text column' that I am updating with the result of the flow. Can I tweak the flow to achieve that? 

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard