web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extract lines from the...
Power Automate
Answered

Extract lines from the body of an email

(1) ShareShare
ReportReport
Posted on by 12
i have alert notifications coming in when something fails on an automated task.  the body of the email is a bit messy and i am trying to extract certain lines and add to a table of a sharepoint file.  i already have a condition in the flow that will only execute the add row into table step if body contains 'tag10 was not resolved,' my problem is extracting the specific lines.
 
from the below, i would like to extract multiple lines and add them into several columns of a table
1. the line that begins with '<businessTaskId' and ends with '</businessTaskId>' and put it into column 1 of a table
2. the line that equals '<reasonCode>-21</reasonCode>' and add it to column 2
3. the line that begins with '<description>tag10 was not resolved' and add it to column 3
 
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,974 Moderator on at
    Hi,
     
     
    Certainly you can do this.
     
    You will have to do multiple Splits and then grab the inside value
     
    At the top of your flow add 3 Compose Actions
    Rename them to like BusinessTaskId, ReasonCode, Description
     
    1. the line that begins with '<businessTaskId' and ends with '</businessTaskId>' and put it into column 1 of a table
    To get this one use this expression in your first Compose action
     
    split(split(YourHtmlToTextOutput, '')[1], '')[0]
     
    make sure you type the words i put (you didnt add it as text, so I had to paste in the picture. Make sure both sets of words have single quotes around it
     
    that gives you the business task id
    So what happens is, it splits it by that string, and creates 2 results in an array and we want the 2nd or right side of the split, which in arrays is index 1
    Then we split THAT string by the closing bracker of busienssTaskId, which gives us again 2 items in an array, but we want the left side of 0 which gives us the id.
     
     
    2. the line that equals '<reasonCode>-21</reasonCode>' and add it to column 2
    Now in your second compose do exactly the same thing, just change the strings
    split(split(YourHtmlToTextOutput, '<reasonCode>')[1], '</reasonCode>')[0]
     
     
    3. the line that begins with '<description>tag10 was not resolved' and add it to column 3
    and again 
    split(split(YourHtmlToTextOutput, '<description>')[1], '</description>')[0]
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 630

#2
Valantis Profile Picture

Valantis 420

#3
11manish Profile Picture

11manish 350

Last 30 days Overall leaderboard