cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mikevrm
Frequent Visitor

Flow to add email body details to sharepoint list

Hi,

 

I am very new to flow so apologies if this is a basic question. 

 

I have created a flow that creates a new SharePoint list item when an email is received with a specific subject. I need to expand this flow so that it allows me to capture the following information:

 

  • Email Address - can be taken from sender address
  • First Name - currently in email body
  • Last Name - currently in email body

The idea of this flow is to generate a mailing list for a newsletter which is then uploaded elsewhere for a mail campaign.

 

The current body of the emails received are as follows:

 

First Name: Joe

Last Name: Bloggs

Email Address: joe.bloggs@domain.com

Date of Signup: 09/11/2019

 

How do i extract the names from the email body?

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

 

Hi @mikevrm ,

 

If the format of the email body is as you provided, please refer to the following method to get the names. Use Split() function to extract data.

First Name:

trim(split(split(body('Html_to_text'),'First Name:')[1],'Last Name:')[0])

Last Name:

trim(split(split(body('Html_to_text'),'Last Name:')[1],'Email Address:')[0])

 Image reference:

104.PNG

Hope it helps.

 

Best Regards,

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.

View solution in original post

2 REPLIES 2
v-bacao-msft
Community Support
Community Support

 

Hi @mikevrm ,

 

If the format of the email body is as you provided, please refer to the following method to get the names. Use Split() function to extract data.

First Name:

trim(split(split(body('Html_to_text'),'First Name:')[1],'Last Name:')[0])

Last Name:

trim(split(split(body('Html_to_text'),'Last Name:')[1],'Email Address:')[0])

 Image reference:

104.PNG

Hope it helps.

 

Best Regards,

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.

View solution in original post

Hi Barry,

 

Thank you for your solution. I have implemented the compose for "first name" & "last name" and the flow works if the email is sent directly to me. However if the email is forwarded to me (which happens 25% of the time) I receive the below error:

 

 

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2756': 'The template language expression 'trim(split(split(body('Html_to_text'),'First Name:')[1],'Last Name:')[0])' cannot be evaluated because array index '1' is outside bounds (0, 0) of array. Please see https://aka.ms/logicexpressions for usage details.'.

 

this happens on the first compose step (First Name)

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (963)