cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rfeather89
Level: Powered On

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
Community Support Team
Community Support Team

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

Community Support Team
Community Support Team

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 274 members 6,068 guests
Please welcome our newest community members: