Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Splitting string and performing action for each?

(1) ShareShare
ReportReport
Posted on by

I found a question from almost a year ago about splitting a string into and array of substrings.

 

This was suggested as the solution by yoshihirok and v-micsh-msft:

 

1.PNG

 

I have since attempted to set up a flow with identical parameters and it fails, it appears to not be actually splitting the string but

passing the whole input in the compose action. Here's a shot of the error I get.

 

Capture.PNG

 

Is there some sort of formatting error with my JSON? When I set it up to just blast me an email with the output it sends me "@split('Hello #a1',' ')"

  • Userofoffice365 Profile Picture
    6 on at
    Re: Splitting string and performing action for each?

    Hi,thanks, but what if we want to make a different action for each item ?

     

    For example I would like to copy each item in their own excel columns.

     

    thanks !

  • Verified answer
    Community Power Platform Member Profile Picture
    on at
    Re: Splitting string and performing action for each?

    What worked for me, and be prepared for it to change because flows seems to be changing regularly, is wrap the entire JSON command in quotes. I suspect this is because it is a Key:Value pair to be sent in a REST request to flows backend in Azure.

     

    E.g. (Compose)

    "@split('This-String-Will-Split','-')"

     

     

    and (Compose 2 in applyforeach)

     

    "@item"

     

     

    But when the flow is saved and run it appears in the edit view as this (Take note that the second output is from the @item output not the first compose.):

     

    Capture

     

    So in my case, I was working on enabling notifications to groups in flows rather than just each user. I created a workflow in SP that uses an admin account to check against group members in a given group selected by the user creating a notification. The admin account then adds a temporary entry for each user in the group split by a comma. This is where I use the for each you see. The section in the first compose "triggerBody()?['Group_x003a_Members']?['Value']" gets the linked list I'm using and gets the 'Group_x003a_Members' field containing the list of items to split. I then send a message to each of them and voila! We now have a notification center backend to send reminders to departments and groups.

     

    Hope this helps a little with your endeavours once you see "@split(a,b)" and "@item()" used in a real example. Flows is not quite there yet for most production systems but get your learning in now so you can be ahead of the curve. Feel free to ask me any questions, I don't know much but I'll tell you what I can.

     

    Kind Regard,

    ADMCharles.

     

     

  • Community Power Platform Member Profile Picture
    on at
    Re: Splitting string and performing action for each?

    having the same problem - where do the double quotes go?

  • Verified answer
    Community Power Platform Member Profile Picture
    on at
    Re: Splitting string and performing action for each?

    Found the problem, JSON has to be encapsulated in " " (double quotations) to actually execute or else it'll be sent as a string.

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >