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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Concatenate expression...
Power Automate
Answered

Concatenate expression for dynamic name field

(0) ShareShare
ReportReport
Posted on by

I have this expression that returns a displayname field from this: Hickman, Kelly to this: Kelly Hickman

 

concat(split(triggerOutputs()?['body/Assignedto0/DisplayName'], ' ')[sub(length(split(triggerOutputs()?['body/Assignedto0/DisplayName'], ' ')), 1)], ' ', split(triggerOutputs()?['body/Assignedto0/DisplayName'], ',')[0])
 
Works great. My issue is when my displayname has a middle initial: Christensen, Deborah A. It returns A Christensen.
 
How would I get the expression to capture the firstname lastname in both situations and disregard the middle initial?
Categories:
I have the same question (0)
  • Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at

    Hi @KellyHickman 

     

    in case of Christensen, Deborah A , should the output be Deborah A Christensen or Deborah Christensen

     

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • KellyHickman Profile Picture
    on at

    She would accept either. Thank you for the assistance.

  • Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at

    Hi @KellyHickman 

     

    placing the name in compose action like below

    Nived_Nambiar_0-1711655115888.png

     

    used below expression in another compose action

    Nived_Nambiar_1-1711655139629.png

     

    Expression -  join(reverse(split(outputs('Compose_-_name'),',')),' ')

     

    Output

    Nived_Nambiar_2-1711655178298.png

     

     

    Other form of output (ignoring middlename in output)

     

    Nived_Nambiar_3-1711655476363.png

     

    Expression - 

    concat(first(split(trim(split(outputs('Compose_-_name'),',')?[1]),decodeUriComponent('%20'))),' ',first(split(outputs('Compose_-_name'),',')))
     
    Output >
    Nived_Nambiar_4-1711655510746.png

     

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • KellyHickman Profile Picture
    on at

    I appreciate the help Nived, but where does this go in my flow? I still have other names that need to be fed into the email and if I'm specifically adjusting Deborah's name, what happens to the other names?

     

    If I set it up as you've detailed, this is what I think it looks like in my Flow. The issue comes in the Send email step. Any number of names could be fed to that email, I need that expression in the body of the email to reflect firstname lastname. The expression I currently have in the body of the email does that for me, except for Deborah's middle initial situation. How would I edit that expression in the body of the email to reflect the new Compose steps I just added?

    KellyHickman_0-1711656576337.png

     

     

    KellyHickman_1-1711656652379.png

     

  • Verified answer
    Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at

    Hi your expression seems to be not handling the case of middle name as it is taking last word after splitting with space as first name which is not same when middle initial is there.

     

    In the current expression which I have shared, replace the compose outputs with this triggeroutputs in your case

     

    concat(first(split(trim(split( triggerOutputs()?['body/Assignedto0/DisplayName'],',')?[1]),decodeUriComponent('%20'))),' ',first(split(triggerOutputs()?['body/Assignedto0/DisplayName'],',')))

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • KellyHickman Profile Picture
    on at

    Works perfectly! Thank you so much!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard