cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
guyinazo
Level 8

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
Super User
Super User

Re: Email salutation

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

Super User
Super User

Re: Email salutation

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
Super User
Super User

Re: Email salutation

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

guyinazo
Level 8

Re: Email salutation

Thanks, exactly what I needed

Highlighted
guyinazo
Level 8

Re: Email salutation

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.

Super User
Super User

Re: Email salutation

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

guyinazo
Level 8

Re: Email salutation

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

ras1000
Level: Powered On

Re: Email salutation

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,370)