cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
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

Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (8,133)