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

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.

View solution in original post

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (59,204)