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 / How to change Last Nam...
Power Automate
Unanswered

How to change Last Name to First Name in power automate?

(0) ShareShare
ReportReport
Posted on by 65

I have a flow that when an item is created, an email is sent to the person who created the item.
In the body of the email to be sent, I put the "Created by", but the format is first the "last name" and then the "first name", but I would like to have the first name and then the last name. Is there any way to create an expression to change this?

 

Example:
how it is sent: Gartner, Henrique
how would I like it to be: Henrique Gartner

 

Thanks

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

    Hi @hgartner,

     

    You could use an expression for that with a split and concat function. Obviously this only works if there is always a comma character as a separator.

     

    concat(split(outputs('Compose'), ',')[1], ' ', split(outputs('Compose'), ',')[0])

     

    split_displayname.png

  • Verified answer
    Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @hgartner,

     

    I forgot about the leading space character.

     

    I have added a replace function for that in the expression:

    concat(replace(split(outputs('Compose'), ',')[1], ' ', ''), ' ', split(outputs('Compose'), ',')[0])

     

  • hgartner Profile Picture
    65 on at

    Hi Dennis,

    Thank you very much. The expression works for the Compose whose value is entered manually. But when I put a value from a sharepoint list, it gives the following error in the split:

     

    Could not process template language expressions in 'Compose_2' entries of action in row '1' and column '27301': 'Template language function 'split' expects first parameter to be of type string . The value provided is of type 'Array'.

     

    hgartner_0-1631896673280.png

     

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @hgartner ,

     

    Can you place the second compose action also within the apply to each action?

  • hgartner Profile Picture
    65 on at

    Yes, but the output of compose 2 does not appear in dynamic content to add it to the body of the message to be sent in the email.

     

    hgartner_0-1631899639524.png

     

  • Verified answer
    Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @hgartner,

     

    That compose action is just an example of presenting the new name. You should also be able to use that expression directly in the body (corpo) of the e-mail action via the expression (expressão) editor.

  • hgartner Profile Picture
    65 on at

    Ahh, I get it. I was using the output of compose to add to the message body. I made the expression directly in the body of the message and it worked.

    Just a note, I forgot to mention that the name is made up of a bracketed reference. Would it be possible to delete?

    For example: Gartner, Henrique [Netherlands]
    Result after applying the expression: Henrique Gartner

  • Verified answer
    Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @hgartner,

     

    Can you use the following expression for the names with the bracketed reference:

    concat(replace(split(split(outputs('Compose'), ',')[1], '[')[0], ' ', ''), ' ', split(outputs('Compose'), ',')[0])

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard