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 / Convert Microsoft Form...
Power Automate
Unanswered

Convert Microsoft Forms Array to Bullets

(0) ShareShare
ReportReport
Posted on by 4

Hello,

 

I’m using the “Send an Outlook email for each Microsoft Forms survey response” Flow template and I would like to convert the arrays sent in the form to bullets (unordered list). 

 

flow.jpg

 

For example, the form contents currently come through like this:

 

Name: ["Bill","Robert","Paul"]

 

And I’d like to convert to this:

 

  • Bill
  • Robert
  • Paul

 

Following a few examples on the Internet, I figured I’d take the following approach:

 

  1. Wrap the entire field name with <ul></ul> in my email source code (placing the output in-between)
  2. Next I would use string replacement to swap the brackets [] with <li>’s and remove the double quotes using the 3 Compose functions below:

 

The expression in Compose is: replace(body('When_a_new_response_is_submitted')?['r6944a0257ae344fc8c35bd2a7cf1363e'],'["','<li>')
The expression in Compose 2 is: replace(outputs('Compose'),'"]','</li>')
The expression in Compose 3 is: replace(outputs('Compose_2'),'","','</li><li>')

 

My first issue is I keep getting the error below (in two different browsers and clearing cache).

 

The template validation failed: 'The action(s) 'When_a_new_response_is_submitted' referenced by 'inputs' in action 'Compose' are not defined in the template.'.

 

My second question is, it this the best way to go about this?  Is there a built-in method or more efficient method of doing this?  Also, since I can’t get past the initial error, I’m not sure whether what I have will actually work so any thought/feedback anyone can provide would be helpful.

 

Thanks

Categories:
I have the same question (0)
  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    @flow2_usa 

    Hi there.  I think there needs to be a step immediately after your trigger to get the forms responses.  I don't think the data from the form is included in the trigger (or have you verified that, already?)

     

    Check that and keep us posted.

    -Ed-

     

     

    If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • flow2_usa Profile Picture
    4 on at

    Apologies, this is only my second day using Flow (and forms for that matter).  

     

    The only thing in the flow is the MS Form followed by the 3 Compose sections and the final Send Email.  If I remove the 3 Compose steps - the email is sent without error.

     

    So how so I get the form's responses for the Compose actions to execute?

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    Ah, ok.  No worries at all, it helps to know where you're coming from.

     

    So, any time you use a Forms trigger, all that is doing is saying "Someone submitted a Form".  All of the stuff on the Form doesn't come along for the ride on the Trigger (which is weird, since most of the other Triggers do this).

     

    Because of this, you'll want to add an action after any Forms trigger called "Get Response Details".  This is going to kick off an "Apply to Each" loop, but don't freak out.  I think Flow is presuming that you're grabbing multiple responses and it wants to get them all.  Just keep doing things inside of the loop and then send the email after the loop.

     

    So, inside of the loop, put in your compose stuff, but now you should see the fields from the Forms and can put those in your Replace functions.  The "Send an Email" part should happen outside of the loop but I don't know if the Compose stuff will carry over.  If not, we can set variables and do the same kind of thing.  I just did a video with something similar:

     

    I'll start messing around with the formatting (adding bullets) in case yours doesn't work, but that should get you pretty close.  Keep us posted.

     

    -Ed-

     

    If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • flow2_usa Profile Picture
    4 on at

    Maybe I'm not adding the forLoop correctly but I can now save the Flow but it generates an error on runtime.  This is what's in the first Compose:

    replace(body('Get_response_details')?['r17cd7d2edd324bc2a844bbe8fa02eed7'],'["','<li>')
     
    flow2.jpg
  • Community Power Platform Member Profile Picture
    on at

    @flow2_usa 

     

    Was this ever resolved? I have the same need. I've got a form field, "Agenda Items", that is submitted by a user (sometimes with bullet points, sometimes not), but I want the list to remain intact when my Flow sends me an email with the info after the from is completed. However, it continually puts the list into a sentence.

     

    I watched the video that @edgonzales posted, but he only references approval flows, which I don't think apply to me.

     

    Any and all help is greatly appreciated. 

  • mneff14 Profile Picture
    3 on at

    Thank you for posting this @flow2_usa! It helped me find a solution for my flow several years later, so I wanted to answer this post and help @Anonymous or any others who might find it useful. 🙂

     

    DISCLAIMER: My solution here covers all arrays in general. Retrieving your specific array may require additional help.

     

     

    The replace() function requires a string and rejects an array, so it won't work for this.

    I used join() instead to convert my array of values into a string formatted as an HTML bulleted list.

    The join() function converts an array into a string while inserting delimiters (text between each item on the array).

     

    To demonstrate, say I have an array variable called 'varMyArray' with the following values:

    ["file1","file2"]

     

    This is the expression I used to surround each item in 'varMyArray' with HTML tags (<li></li>) to create a string formatted as a bulleted list:

    concat(
        '<li>', 
        join(
            variables('varMyArray'), 
            '</li><li>'
        ), 
        '</li>'
    )

     

    IMPORTANT: Notice how join() inserts </li><li> between each item in the array and how concat() surrounds the entire array string with <li></li>.

     

    The following string would be the output of the above expression:

    <li>file1</li><li>file2</li>

     

    As a real example, I used this expression in a flow that archives old SharePoint files. During the flow, the archived file names were appended to an array called 'varFilesArchived'. At the end of the flow, that array was converted into a bulleted list string and the output was inserted into the body of an email.

     

    Here are the relevant steps:

    mneff14_0-1664379081625.png

     

    Here is the resulting email:

    mneff14_1-1664379081626.png

    NOTE: This flow usually archives only one file per run, but the expression still works.

     

    Hope this is helpful! 😉

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard