cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bclarkuncc
Level: Powered On

Convert Name to Email Address

Does anyone have a recommendation/example of the best way to take a field from Sharepoint and convert it to an email address.  I have a field in Sharepoint where a user selects a name (choice field).   I do not want to use a Person or Group field, as I want to make it a simple choice instead of them having to type in a name.  I want to take this name and convert it to an email address for futher use in the flow.  For example:

 

Choices in Sharepoint:

Bob Ross

Dale Earnhardt

Jim Croce

Taylor Swift

 

Output for use in MS Flow:

Bob.Ross@company.com

Dale.Earnhardt@company.com

Jim.Croce@comporium.com

Taylor.Swift@comporium.com

 

 

Any thoughts?  

4 REPLIES 4
digitech
Level: Powered On

Re: Convert Name to Email Address

There is probably a neater way of doing this but use a Compose action to use an IF statment for each:

 

if(equals(triggerBody()?['FIELD IN SHAREPOINT']?['Value'],'Bob Ross'), 'Bob.Ross@company.com', '')

if(equals(triggerBody()?['FIELD IN SHAREPOINT']?['Value'],'Dale Earnhardt'), 'Dale.Earnhardt@company.com', '')

if(equals(triggerBody()?['FIELD IN SHAREPOINT']?['Value'],'Jim Croce'), 'Jim.Croce@comporium.com', '')

if(equals(triggerBody()?['FIELD IN SHAREPOINT']?['Value'],'Taylor Swift'), 'Taylor.Swift@comporium.com', '')

Community Support Team
Community Support Team

Re: Convert Name to Email Address

Hi @bclarkuncc,

 

You could use Expression-replace() to replace the space of the name with "." and then use the concat() function to add the domain name.

I noticed that the domain name of the user's email may be different. I suggest adding a domain tag to the user's domain name in SharePoint list. The field type can also be Choice. Image reference:

SharePoint list:

38.PNG

Flow:

Formula reference:

concat(replace(items('Apply_to_each')['employee_name']['Value'],' ','.'),'@',items('Apply_to_each')['domain']['Value'])

39.PNG

The result of this expression output is an email that can be used in other Flow actions.

40.PNG

 

Please take a try and let me know if you have any question.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Administrator
Administrator

Re: Convert Name to Email Address

Hello, @bclarkuncc!

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-bacao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!

Thank you for being an active member of the Flow Community!

-Gabriel
Flow Community Manager

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!
CH3RR3RA
Level: Power Up

Flow Forms Convert Name to Email Address

Hello @digitech 

Would you be able to provide the same script but for flow.  Instead of pulling the data from sharepoint I would like to pull the data from a field in a form.  

 

Any help you could provide would be appreciated.

 

Thank you!

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,565)