cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Extracting text from email

It looks like this has been asked a hundred times, but everyone has their own situation specific to their situation...so apologies if this has already been asked!

 

I'm looking to trigger an SMS when a P1 or P2 incident is raised, we already make use of Flow for this, however the requirements have changed and I'll need to text the body of an email, rather than the subject.

 

The body looks like this, after using "HTML_to_Text"

 

A new High Priority Incident (HPI) has been raised and requires managing.

Incident Details

Number:

INC0123456
Primary Incident Management Group:

*********************

Summary:

The thing is broken!

Configuration Item:

CI of broken thing

Assignment Group:

Assignment group of resolver

Status:

New

 

What I need is to pull out the text underneath the "Number:" and "Summary:" lines highlighted in blue. I've set-up the below expressions:

 

Compose:

length(body('Html_to_text'))

Compose2:

add(indexOf(body('Html_to_text'),'Number'),10)

Compose3:

add(indexOf(body('Html_to_text'),'Summary'),10)

Compose4:

substring(body('Html_to_text'),actionOutputs('Compose_2'),sub(actionOutputs('Compose_3'),actionOutputs('Compose_2')))


However, I appear to be getting everything between the n of the incident number and the last colon after Summary.

 

Any suggestions? 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Extracting text from email

 

Hi @rfeather89 ,

 

Please try to use the following expression to get specified data.

Number:

trim(first(split(last(split(body('Html_to_text'),'Number:')),'Primary Incident Management Group')))

Summary:

trim(first(split(last(split(body('Html_to_text'),'Summary:')),'Configuration Item')))

Image reference:

57.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
Dual Super User
Dual Super User

Re: Extracting text from email

Hi,

 

Use

 

substring(body('Html_to_text'),sub(actionOutputs('Compose_2'),1),sub(sub(actionOutputs('Compose_3'),actionOutputs('Compose_2')),9))
 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Community Support
Community Support

Re: Extracting text from email

 

Hi @rfeather89 ,

 

Please try to use the following expression to get specified data.

Number:

trim(first(split(last(split(body('Html_to_text'),'Number:')),'Primary Incident Management Group')))

Summary:

trim(first(split(last(split(body('Html_to_text'),'Summary:')),'Configuration Item')))

Image reference:

57.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

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Users online (7,682)