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

Extracting a word before new line

Honestly, I am not sure if what I am doing is right, very new with MS Flow.

 

Anyway,

 

I have email regarding routers etc.

 

Usually the email consists of:

 

Affected CI: abcd.router.net

Assignment Group: abcdef

 

I would like to assign the abcd.router.net to a variable so I could check the SharePoint list if there is already an entry regarding that CI.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Extracting a word before new line

Hi @KarlChristopher,

 

Do you want to extract the Affected CI from the email body? Do all the emails always have the same format?

 

Please take the following flow for a reference.

 

The flow is triggered by When an email arrives with the following email body.

1.PNG

Add an action to convert email body to text.

 

Add a Compose action, use the following code:

length(body('Html_to_text'))

Add a Compose 2 action, use the following code:

add(indexOf(body('Html_to_text'),'Assignment Group'),6)

Add a Compose 3 action, use the following code:

substring(body('Html_to_text'),12,sub(outputs('Compose'),outputs('Compose_2')))

 

Then it will return the Affected CI as expected. Please check the following screenshots.

2.PNG3.PNG

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
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
Community Support Team
Community Support Team

Re: Extracting a word before new line

Hi @KarlChristopher,

 

Do you want to extract the Affected CI from the email body? Do all the emails always have the same format?

 

Please take the following flow for a reference.

 

The flow is triggered by When an email arrives with the following email body.

1.PNG

Add an action to convert email body to text.

 

Add a Compose action, use the following code:

length(body('Html_to_text'))

Add a Compose 2 action, use the following code:

add(indexOf(body('Html_to_text'),'Assignment Group'),6)

Add a Compose 3 action, use the following code:

substring(body('Html_to_text'),12,sub(outputs('Compose'),outputs('Compose_2')))

 

Then it will return the Affected CI as expected. Please check the following screenshots.

2.PNG3.PNG

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
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

KarlChristopher
Level: Powered On

Re: Extracting a word before new line

Hello, thank you for the solution. However, I realized that the email I am extracting is actually encrypted or something when trying to do an HTML to text, hence I did very similar things than your solution but I only did it on one expression

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,435)