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 / How to get multi line ...
Power Automate
Answered

How to get multi line field content from the body of an email.

(0) ShareShare
ReportReport
Posted on by 24

Hello! I was wondering if anyone here would know how to extract a multi value field content from an email. 

I get an email everytime a form is submitted. I use the following formula to get a specific line of text. In the following example, I am extracting the text from line 19 that starts after ":".

last(split(outputs('Split_Body_Text')[19],':'))
This works for single value fields. However, when a multi value field is completed, only the first line of text seems to be extracted. 
Here is the beginning of my flow:
aghaei_0-1704566610186.png

Split Body Text: split(body('Html_to_text'),outputs('EnterKey'))

From here I have a compose action for each field. For example, the Request title: last(split(outputs('Split_Body_Text')[6],':'))

 

Here is the split body text from a run:

aghaei_1-1704566805066.png

The issue of course is that the number of lines in the multi line field "Request Details" can range, so the count of rows ranges. I wondering if there is a split calculation that would capture text that starts on line 19 after ":" and ends before the word "How". Help please =))

 

Categories:
I have the same question (0)
  • Verified answer
    creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @aghaei For my demo, I have the following string of text in a Compose action. Tip. Remember to rename your Compose actions to keep things organized. It will also make it easier to see which output belongs to which Compose action.

    creativeopinion_23-1704584932070.png

    Split at Request Details

    You could first split the body text at "Request Details: ". Add a Compose action. The split() function takes two parameters. The first parameter is the string of text you'd like to split. The second is the separator. You can use anything as a separator. Typically it's a punctuation mark such as a comma, colon, semi-colon etc. However you can also use strings of text.

    split([string],[separator])

    Start off with the split() function.

    creativeopinion_0-1704591399602.png

    Tip: Take a look at the tool tip whenever you are composing expressions as the tooltip will bold the current parameter you are defining.

     

    The first parameter (string) will be the string of text. Select the Dynamic content tab and select the appropriate dynamic content in your flow. In my case, it's the output of the Compose action that is storing the sample text. 

    creativeopinion_2-1704591515583.png

    Add a comma and single quotes. Between the single quotes will be the separator you'd like to split your string at. In this case it's Request Details: (note the space after the colon). 

    creativeopinion_19-1704584661674.png

     

    last(split([string],[separator]))

    Wrap that split() function in the last() function. Go to the start of the expression by pressing the Up Arrow Key and type in last with an opening parenthesis.

    creativeopinion_20-1704584712117.png

    Go to the end of the expression by pressing the Down Arrow Key and type in a closing parenthesis.

    creativeopinion_21-1704584723403.png

     

    Your expression will look something similar to this (keep in mind the dynamic content in your case may be different and you will need to adjust accordingly. 

    last(split(outputs('Compose_-_Body_Text_Sample'),'Request Details: '))

     

    Run a test. The output will be the text after "Request Details: ".

    creativeopinion_22-1704584838152.png

    Split at How Will You Use This Information

    Next, Add a Compose action.

    creativeopinion_25-1704585065339.png

     

    Split the output from the previous Compose action at "How will you use this information: ".  Insert the split() function, click on the Dynamic content tab and insert the output from the previous Compose action.

    creativeopinion_26-1704585121589.png

    Just as I demonstrated in the previous section, add a comma and single quotes. Between the single quotes enter the separator. In this case it's How will you use this information: (note the space after the colon). 

     

     

    creativeopinion_10-1704581576862.png

     

    Wrap the split() function in the first() function to return the multi-lines of text. Go to the start of the expression by pressing the Up Arrow Key and type in first with an opening parenthesis.

     

    creativeopinion_6-1704581485432.png

    creativeopinion_7-1704581496161.png

     

    You could also wrap the entire expression in a trim() function to remove any whitespace from the start and end of the string of text.

    creativeopinion_27-1704585312910.png

    Go to the end of the expression by pressing the Down Arrow Key and type in a closing parenthesis.

    creativeopinion_28-1704585323581.png

    Your expression will look something similar to this (keep in mind the dynamic content in your case may be different and you will need to adjust accordingly. 

    trim(first(split(outputs('Compose_-_Split_at_Request_Details'),'How will you use this information: ')))

    Run a test. You should be left with multi-lines of text (no matter the length).

    creativeopinion_29-1704585350356.png

    Tip: If you want to reduce the amount of vertical space these actions take up in your flow—use a Scope action!

    creativeopinion_30-1704585412764.png

    I like using Scope actions in my flow to keep things organized. You can also easily collapse multiple actions with a single click!

    creativeopinion_31-1704585454493.png

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉Watch my tutorials on YouTube
    👉Tips and Tricks on TikTok

    You might be interested in my latest YT Tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows

    In this tutorial I cover:

     How to troubleshoot a false Condition action result

     How to get dynamic content when it isn’t selectable from the list of dynamic content

     How to troubleshoot an Apply to Each action that isn’t looping through

     How to troubleshoot a skipped Apply to Each action

     How to troubleshoot a Filter Query

     How to use a SharePoint yes/no column in a Filter Query

     How to use Compose actions to troubleshoot a Power Automate flow

    How to troubleshoot multiple emails being sent

     How to troubleshoot multiple Teams messages being sent

  • aghaei Profile Picture
    24 on at

    thank you @creativeopinion for your reply. I tried following but I don't think I am getting it. Do you think you can copy paste the actual compose actions so I can try following again?

  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @aghaei I have updated the post above to explain how to build the expressions. By understanding how to build expressions (as I've demonstrated above) it'll make it easier for you to build expressions for future flows.

     

    If you just copy and paste and replace without fully understanding how the expression is built—it'll make it a lot more challenging for you to troubleshoot.

  • aghaei Profile Picture
    24 on at

    I think I got it for the most part, but the last step doesn't let me do the separation. Here is my compose and the results. Do you see any issues with my compose action? It runs successfully, but it doesn't actually split from the rest of the text. 

    first(split(outputs('C1last'),'How will yo use this information: '))
     

    aghaei_0-1704593501587.png

     

  • Verified answer
    creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @aghaei There must be an issue with your separator—possibly an extra space or a typo. I would recommend you copy the text to your clipboard from the output of the C1last action.

    creativeopinion_0-1704655914254.png

     

    Paste it directly into your expression and run another test.

     

     

  • aghaei Profile Picture
    24 on at

    @creativeopinion  Thanks so much for the tip! I did exactly what you suggested and the issue is gone. I appreciate you taking the time to help out!

  • aghaei Profile Picture
    24 on at

    Thank you @AlexEncodian - I checked it out, but it seems a bit more complicated than what I was looking for. thank you anyways!

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard