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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Split Email Body to ex...
Power Automate
Answered

Split Email Body to extract Text

(0) ShareShare
ReportReport
Posted on by 27

Step 1) I have used trigger "when a new email arrives" to get the email

 

Step 2) "Html to text" action to get the body of the email

 

Step 3) "Compose" action to Split Email body to Lines as shown in the SS attached

I/p: split(outputs('Html_to_text')?['body'], '\n')
 
Step 4) "Apply to each" here I used output of the Split Email body to Lines
 
Step 5) "Compose" action to get Each Item in the array
 I/p: item()
 
Step 6) "Condition" to check Suggested Actions
I/p: Output of Step 5 -> contains -> Suggested Actions :
 
if yes,
Set variable
Name: VariableName
Value: trim(first(split(last(split(item(), 'Suggested Actions :')), ' *** This')))
 
After splitting text of email body below array I get:
[
"Alarm Name : Queue Link Error Details :\nQueue Link Error: Message=From MY00SISEPSN01.AP.MT.MTNET To\nch00siseadm01.eu.mt.mtnet; Cause=Closed Description : The queue link between two\nnodes in the ISE deployment is down. Severity : Critical Suggested Actions :\nPlease check and restore connectivity between the nodes. Ensure that the nodes\nand the ISE Messaging Service are up and running. Ensure that ISE Messaging\nService ports are not blocked by firewall. Please note that these alarms could\noccur between nodes, when the nodes are being registered to deployment or\nmanually-synced from PPAN or when the nodes are in out-of-sync state or when the\nnodes are getting restarted. *** This message is generated by Cisco Identity\nServices Engine (ISE) *** Sent By Host : ch00sisemon02"
]
 
I want to Extract text of "Suggested Actions" as follows:
Please check and restore connectivity between the nodes. Ensure that the nodes and the ISE Messaging Service are up and running. Ensure that ISE Messaging Service ports are not blocked by firewall. Please note that these alarms could occur between nodes, when the nodes are being registered to deployment or manually-synced from PPAN or when the nodes are in out-of-sync state or when the nodes are getting restarted.
 
But due to newline i.e. \n after Suggested Actions :\n I am not able to get the above output how to achieve this?
x1.PNG
x0.PNG
x01.PNG
Categories:
I have the same question (0)
  • demonpratz Profile Picture
    27 on at

    Below is my Email Format:

     

    Alarm Name :

    Queue Link Error

     

    Description :

    The queue link between two nodes in the ISE deployment is down.

     

    Severity :

    Critical

     

    Suggested Actions :

    Please check and restore connectivity between the nodes. Ensure that the nodes and the ISE Messaging Service are up and running. Ensure that ISE Messaging Service ports are not blocked by firewall. Please note that these alarms could occur between nodes, when the nodes are being registered to deployment or manually-synced from PPAN or when the nodes are in out-of-sync state or when the nodes are getting restarted.

     

    *** This message is generated by Cisco Identity Services Engine (ISE) ***

     

    Sent By Host : ch00sisemon02

  • lbendlin Profile Picture
    8,551 Super User 2026 Season 1 on at

    You are already splitting by NewLine, so you should then be able to grab the array element that has your target text.

     

    What made you convert the HTML to text?  Might be easier to parse the initial HTML?

  • SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @demonpratz  ,

     

    Since this email is a system generated email I am assuming that the email format will be fixed, so please see if the below steps helps.

     

    I am trying to extract the Suggested Actions substring by splitting it based on that and by calculating the length of the substring.

     

    S1S1S2S2S3S3

     

    See if the above steps help.

     

    Please mark this as a solution if this helps.

     

    Thanks,
    Sanmesh

  • demonpratz Profile Picture
    27 on at

    .

  • demonpratz Profile Picture
    27 on at

    What expression is used in the last step?

  • SanmeshG Profile Picture
    1,947 Moderator on at

    @{last(outputs('split'))}

  • demonpratz Profile Picture
    27 on at

    Ok! Thanks.

     

    Any alternative solution for this in few steps?

  • SanmeshG Profile Picture
    1,947 Moderator on at

    The expression used to get the length of substring(subtraction) you can directly use it extracted substring instead of using a compose and then passing it.

     

    Also the last step can be skipped by direct using the last expression on the array that you get in split step.

  • demonpratz Profile Picture
    27 on at

    Can you provide the solution using condition? @SanmeshG 

    x1.PNG
    x2.PNG
  • SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @demonpratz ,

     

    Please follow the steps I have shared in the given problem , I am using the Suggested Steps : string itself to split and extract the substring , that should solve your problem I believe.

     

    Please give this a thumbs up and considering marking this a solution if this helps!

     

    Thanks,

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 248 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 207 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 101 Super User 2026 Season 1

Last 30 days Overall leaderboard