cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rfeather89
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
v-bacao-msft
Community Support
Community Support

 

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

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

v-bacao-msft
Community Support
Community Support

 

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.

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,992)