cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
guyinazo
Advocate V
Advocate V

Email salutation

In my flow, I am sending the DisplayName and email from a power app.  I want to include the user first name in the body as a salutation.  How can I extract just the first name from DisplayName?  Is there a way to do a substring, or Right function? 

 

Thanks for the information

 

Brad

2 ACCEPTED SOLUTIONS

Accepted Solutions
ScottShearer
Super User
Super User

Here is an example that should help.

 

In my test, I am getting the display name from a variable called varDisplayName.

 

substring(variables('varDisplayName'),0,indexOf(variables('varDisplayName'),' '))

 

I an using the substring() expression - I am saying that I want part of a string and I want to start at position 0.

I am also saying that I want a certain number of characters - I am looking for the first space and retrieving the position of that space using the indexof() expression.  The position of that space is the number of characters I want.

 

If you need additional help, please post here.

 

If this solves your issue, please mark your question as Solved.

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

OK - try this

first(split(variables('varDisplayName'),','))
 
Split breaks the string into two parts broken at the comma.
First gets the first row in the table that was created when breaking the string at the comma (i.e. the last name).
 
Scott
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

6 REPLIES 6
ScottShearer
Super User
Super User

Here is an example that should help.

 

In my test, I am getting the display name from a variable called varDisplayName.

 

substring(variables('varDisplayName'),0,indexOf(variables('varDisplayName'),' '))

 

I an using the substring() expression - I am saying that I want part of a string and I want to start at position 0.

I am also saying that I want a certain number of characters - I am looking for the first space and retrieving the position of that space using the indexof() expression.  The position of that space is the number of characters I want.

 

If you need additional help, please post here.

 

If this solves your issue, please mark your question as Solved.

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Thanks, exactly what I needed

I thought that is what I need.  Our Display Name from the adfs is LastName, FirstName and this substring formula returns the LastName only.  So I would need everything after the comma.

OK - try this

first(split(variables('varDisplayName'),','))
 
Split breaks the string into two parts broken at the comma.
First gets the first row in the table that was created when breaking the string at the comma (i.e. the last name).
 
Scott
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Yep, that did work, except I changed "first" to "last" as I want the first name in the salutation.  Thank you for your help

This very close to what I am endeavouring to for the email salutation.  I used

 

substring(variables('FatherFirstLast'),0,indexOf(variables('FatherFirstLast'),' ')

 

however, get a "Definition contains invalid parameters." message when I try to save the flow.

 

So far, I have not been able to sort out why I am getting the error.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,377)