Skip to main content

Notifications

Power Automate - Building Flows
Answered

Converting create by display name into First Name, Last Name

Posted on by 70

I have a flow that uses create by display name in numerous places throughout the flow, including populating a list, sending an email, and popping the name in an approval notification. I need the name to be First Name, Last Name. 

Formatting name in Flow - Power Platform Community (microsoft.com)

Solved: Power Automate Action to Extract First Name from P... - Power Platform Community (microsoft.com)

Solved: How to change Last Name to First Name in power aut... - Power Platform Community (microsoft.com)

Solved: Convert first name last name field in MS Form to e... - Power Platform Community (microsoft.com)

Do not provide a valid solution, primarily because of the vagueness of the "accepted answer" that doesn't actually provide specific details or examples of how to actually accomplish the desired effect. The only thing those answers got right is a concat function is needed, but no details on how to grab the create by display name from the "When an Item is updated" action and fold it into a compose that will switch the last and first name order. 

 

  • Verified answer
    creativeopinion Profile Picture
    creativeopinion 9,917 on at
    Re: Converting createby into First Name, Last Name

    @tpcolson Sorry about that. In my tenant the display name returns as First Name and Last Name.

     

    If your display name dynamic content is returning as LastName, FirstName you need to use an expression to output the content as FirstName LastName.

     

    In my demo, I'm using a Compose action to store a string: LastName, FirstName. 

     

    In another Compose action, I've used this expression:

     

    concat(split(outputs('Compose_-_Lastname,_Firstname'), ', ')[1], ' ', split(outputs('Compose_-_Lastname,_Firstname'), ', ')[0])

     

    creativeopinion_0-1714933386029.png

    In the expressions, I've used the split() function to break a string into parts based on a specified delimiter. In this case, I've used it to split the input string into two parts - the last name and the first name. The delimiter I've used a comma and space ", ".

     

    The split() function returns the string as an array. Array items can be accessed with an index. The first item of an array is [0], second is [1] and so on. In this case, the [0] will return the last name and a [1] will return the first name.

     

    The concat() function combines the multiple strings together. In this expression, I've used it to combine the first name and the last name into a single string.

     

    concat(split([insert your display name dynamic content here], ', ')[1], ' ', split([insert your display name dynamic content here], ', ')[0])

    Run a test.

    creativeopinion_1-1714933405100.png

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution ✅.
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

     

  • tpcolson Profile Picture
    tpcolson 70 on at
    Re: Converting createby into First Name, Last Name

    I'm well aware of how to get the display name. Problem is, it's Last Name, First Name. I need to reverse it to First Name Last Name without the comma. And no, having my organization change the AD/O365 display name setting for 30000 users is not the solution either. 

  • creativeopinion Profile Picture
    creativeopinion 9,917 on at
    Re: Converting createby into First Name, Last Name

    @tpcolson To get the Display Name (First Name and Last Name) of the Created By user use the Created By DisplayName dynamic content from the When an item is created or modified trigger.

     

    creativeopinion_0-1714928078251.png

     

    For flow troubleshooting tips—check out this YT Tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows

     

    In this Power Automate tutorial, I explore 5 frequently asked questions that pop up when troubleshooting a flow. If you’d like to to level up your Power Automate flow skills and learn how to troubleshoot your Power Automate flow—this tutorial is for you!

     

    IN THIS VIDEO:

    ✅ How to troubleshoot a false Condition action result

    ✅ How to get dynamic content when it isn’t selectable from the list of dynamic content

    ✅ How to troubleshoot an Apply to Each action that isn’t looping through

    ✅ How to troubleshoot a skipped Apply to Each action

    ✅ How to troubleshoot a Filter Query

    ✅ How to use a SharePoint yes/no column in a Filter Query

    ✅ How to use Compose actions to troubleshoot a Power Automate flow

    ✅ How to troubleshoot multiple emails being sent

    ✅ How to troubleshoot multiple Teams messages being sent

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution ✅.
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

     

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard