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 / Struggling with extrac...
Power Automate
Answered

Struggling with extracting text from an email subject line

(1) ShareShare
ReportReport
Posted on by 34

Hi,

  I've found several examples and video tutorials about the split function and using it to separate/extract values from an item, but I just cant seem to figure out how to apply it to my situation.

 

I have an "When a new email arrives" trigger based on a subject filter, and then a planner task is created using the subject as the title.

 

However, there is a lot of extraneous info in the subject line I would like to strip out for the task title. The format of the subject is something like:

 

Subject: New Request #111 assigned to My Team, Add user to X

 

And all I really want to make the task from is the part after the comma, "Add user to X".

 

Can someone explain or provide an example of how that should look, and how it should be entered into the title field of the "Create a task" action?

 

 

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,960 Moderator on at

    Hi @chumproast 

     

    Super simple, you could do it in the Name field or from a Compose and lets rename it to Split Subject

    So lets say I add a Compose (after the email comes in)
    
    In the Expression for the Compose you would do something like this
    
    split(PutTheSubjectDynamicPropertyHere, ',')

    This will give you back a small Array of the 2 pieces and we want the second one.

     

    Now in the Name field or whatever it goes put the expression

    trim(Outputs('Split_Subject'))[1]
    

    This will take the second split value, which is the part you wanted and remove any trailing or ending spaces.


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

     

  • chumproast Profile Picture
    34 on at

    Errror with my flow trying to follow these steps. I bet I'm close!

     

    I understand the function and syntax with the split command in compose (and why I couldnt do this on my own since I was trying to include it as part of the create planner task action), but how is trim supposed to work?

     

    I think it's because you made a mention to "name the compose", which I assume should be what trim is referencing ('Split_Subject')  but I'm not sure how I would add a name/title to my compose step.  I tried:

     

    trim(outputs('Compose'))[1]

     

    But that failed with the error:

    The provided parameters for the template language function 'trim' are not valid.'.

     

    Your help is appreciated.

     

     

     

     

  • Verified answer
    chumproast Profile Picture
    34 on at

    Ok, it's actually more simple than I thought. @FLMike got me over my confusion, and then trial, lots of error, and searching around lead me to the solution.

     

    Adding a compose action to split the subject line using the comma as the delimiter:

     

    split(triggerOutputs()?['body/subject'], ',')

     

    and then in the create planner task action, the title only needs the correct output from the compose action in order to function correctly (no trim needed)

     

    outputs('Compose')[1]

     

    And my task is being created with the correct title in Planner. 

     

    Thanks again for your help.

  • Michael E. Gernaey Profile Picture
    53,960 Moderator on at

    Hmm so @chumproast 

    essentially you did what I said to do, then gave yourself credit.. gotcha..

  • chumproast Profile Picture
    34 on at

    Uh.. you suggested using the trim function, which didn't work?

     

    I discovered it wasn't needed, I simply had to output the result of the compose action and posted that as the correct solution.

     

    But if something like "credit" for a solution is that big of a deal to you...

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 286

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard