Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

For each loop on Forms answers

(0) ShareShare
ReportReport
Posted on by 34

In my form, I want the responder to be able to add multiple urls to one answer separated by commas. In flow, I want to be able to display those links in a Teams message (which I have set up and working properly). The only way I've seen to display links from a Forms response is to wrap it in HTML:

<a href="[form response]">[form response]</a>

I want to be able to display it in the teams message as 

Links: [link1] [link2] [link3] [link4]... etc.

I'm new to flow and my Google searches... I mean Bing searches... haven't turned up what I'm looking for. Chalk it up to not knowing what things are called, most likely. I've looked through expressions pages in Microsoft docs and understand that you can run loops, but I'm not seeing how to run a loop within a message body like that, only running loops over the items that are generated via actions and triggers. 2019-01-14 12_05_44-Edit your flow _ Microsoft Flow.png

 

 

I know I can split the string by whatever delimiter I tell them to, but can I then loop through the items of the resulting array and tell it to display " <a href="[item()]">[item()]</a>" for each item? The responder will be instructed to submit links separated by commas. link1, link2, link3, etc. Above is basically my full flow (minus the response submitted trigger), so I'm happy to redo any of it to get it to work the way I want. 

  • dgpadia Profile Picture
    34 on at
    Re: For each loop on Forms answers

    This was my first real project with Flow, and you have helped me to understand so much more about how to use it. I understand a lot of the basic concepts of programming (I'm in school for network admin, so we learn coding concepts in C#, but I'm not a programmer), I just didn't know how to set it up in Flow/Azure Logic Apps. Thank you!!

  • Verified answer
    v-bacao-msft Profile Picture
    on at
    Re: For each loop on Forms answers

    Hi @dgpadia,

     

    I am not sure if you want to include these four links in a Teams message, or send four messages to contain these four links. Could you provide a specific example?

    I guess you don't know how to reference the separated elements of the Split() function.

    The Split() function splits the specified String into an array, so you could call the element just by using "Split(‘String')[index]".

    If you want to automatically display the number of links based on the number of URLs populated by the user, you could configure your Flow as follows:

    1. Initialize two variables, one is String, the message is stored, and the other is Integer, which is used to store the index of the link.

    17.PNG

    2. Use the Split() function to split the URLs based on the comma to generate an array.

    split(body('Get_response_details')?['r4edc960694854603b66f7b0a90c35571'],',')

        The first parameter in the expression needs to be populated according to the actual situation of your Forms.

    18.PNG

    3. Traverse the array, in the format of the hyperlink, configure the array elements in the corresponding places, each time you traverse, the index needs to add one.

        Note that Current item is the Dynamic content output by Apply_to_each_2.

        And if you want the final result to show a space between the links, you need to type the space bar in the Value of the Append to string variable.

    4. Finally, configure the String variable in the Message.

    19.PNG

    Image reference:

    20.PNG21.PNG

    Please take a try.

     

    Best Regards,

    Barry

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June 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 > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1