cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 185 members 3,280 guests
Please welcome our newest community members: