cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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

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

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

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

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (82,214)