cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
flow2_usa
Level: Powered On

Convert Microsoft Forms Array to Bullets

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

4 REPLIES 4
Super User
Super User

Re: Convert Microsoft Forms Array to Bullets

@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
Level: Powered On

Re: Convert Microsoft Forms Array to Bullets

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?

Super User
Super User

Re: Convert Microsoft Forms Array to Bullets

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
Level: Powered On

Re: Convert Microsoft Forms Array to Bullets

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 445 members 6,187 guests
Please welcome our newest community members: