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
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])
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
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.
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.
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'.
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])
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])
WarrenBelz
146,618
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,962
Most Valuable Professional