web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : 4HHcrw8tiY/xZDtug4Zomy
Power Automate - Building Flows
Unanswered

How to write multiple choice answers in html ?

Like (0) ShareShare
ReportReport
Posted on 31 Jul 2023 10:16:48 by

Hello everyone, 

 

I have a form in Power Apps, where users can select multiple answers :

Max31_0-1690797906693.png

These choices are saved in a SharePoint list.

 

Then, in power automate, I want to create a PDF file from the item in the list using html code.

Every thing works except the fields where users can select multiple answers (such as the one above) : 

Max31_2-1690798184831.png

 

In my flow, I use the "compose" action to write html code : 

Max31_3-1690798289522.png

For multiple choice questions, I have these three options.

Here, I chose the last one since the first two add a "for each" loop on the "compose" action and completely mess up my pdf file. 

 

Thanks, 

Max

I have the same question (0)
  • Community Power Platform Member Profile Picture
    on 07 Aug 2023 at 09:11:41
    Re: How to write multiple choice answers in html ?

    @ManishSolanki I'm still working on that flow and am facing a new issue.

     

    Basically, the flow used to run on one single item of my sharepoint list ("when an item is created"). Now, I want to change that flow so that it does the exact same thing but on every item in the list.

     

    I understant that I have to use "Get items" instead of "Get item" and that I need an "Apply to each" loop to do the same actions on each item of the list. However, some of the old actions don't seem to work correctly in this loop, like the "Select" action for example.

     

    This "Select" action is automatically put in a new "apply to each" action and I don't understand why. I wrote a post (https://powerusers.microsoft.com/t5/Building-Flows/Run-flow-on-multiple-lines-of-SharePoint-list-filter/m-p/2281364#M253502) about this but can't find a solution so I thought you might have an idea.

     

    Thanks,

    Max

  • Community Power Platform Member Profile Picture
    on 01 Aug 2023 at 11:21:12
    Re: How to write multiple choice answers in html ?

    Forgot to mention that this was the output of the multiple choice field in final "Compose" action :

     

    <p><input type="checkbox" checked/>Lettre d'accompagnement de la révision<br><input type="checkbox"/>Communication dédiée<br><input type="checkbox" checked/>Formation spécifique</p>

  • Community Power Platform Member Profile Picture
    on 01 Aug 2023 at 11:18:08
    Re: How to write multiple choice answers in html ?

    @ManishSolanki Thanks for your help !

     

    I have the flow works (no errors) but the pdf doesn't correspond to what I expected.

    This is what I picked from the multiple choice dropdown in Power Apps :

    Max31_0-1690888313296.png

    But this is what I get in my PDF :

    Max31_1-1690888359016.png

    No checkboxes and not the selected choices 🤔

     

    This is what my flow looks like (I followed your flow but did it twice since I have to fields where there are multiple choices questions) :

    Max31_2-1690888479224.png

    Max31_4-1690888513189.png

    Max31_5-1690888562670.png

    Then in my main "Compose" action : 

    Max31_6-1690888658043.png

    Not sure what happened.

     

    Thanks,

    Max

     

     

     

     

  • ManishSolanki Profile Picture
    15,089 Super User 2025 Season 2 on 01 Aug 2023 at 10:01:35
    Re: How to write multiple choice answers in html ?

    Hi @Anonymous 

     

    I know you are making something special using power automate 🙂

     

    I tried designing a snippet that will create an html tag (checkboxes) based on the options selected in the multichoice field.

    1. I have taken all the possible values of choice fields in an array in Compose action, but you may store in SP list or variable as per your need and initialize an array variable 'varCheckBoxHTMLTagsArray' that holds the final checkbox input tags:

    ManishSolanki_0-1690883085761.png

     

    2. Next, we will store all the selected choice from list item in an array. We use "Select" action to separate it from the other properties to make an array of it:

    ManishSolanki_1-1690883225526.png

    Click "Switch to text mode" on the right side of the Select action:

    ManishSolanki_2-1690883283838.png

    Choose the value of multichoice field from Dynamic content to set its value in Map property:

    ManishSolanki_3-1690883410257.png

     

    3. Now, we will iterate all the possible choice values and find those which are being selected in SP list item. If selected, we will add an attribute checked to input field.

    ManishSolanki_4-1690883638383.png

    You need to write an expression in the If condition to check if choice is being selected or not.

    Expression used for left hand operand:

    contains(body('Select'),item())

    Expression used for right hand operand:

    true

     

    In "Yes" section append the variable with checked attribute:

    ManishSolanki_5-1690883809807.png

    In "No", no need to add an attribute:

    ManishSolanki_6-1690883855915.png

     

    4. Finally, you can join the array variables with line break tag (<br>):

    ManishSolanki_7-1690883945038.png

    Expression used in the above screenshot:

    join(variables('varCheckBoxHTMLTagsArray'),'<br>')

    The output of 'Compose 2' action will give you the required html code.

     

    I hope this helps you in designing the logic to complete your flow.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • Community Power Platform Member Profile Picture
    on 31 Jul 2023 at 11:52:15
    Re: How to write multiple choice answers in html ?

    @ManishSolanki Thank you very much !

    Do you know if instead of joining the choices with a comma, I could put all the choices in checkboxes and only check the ones corresponding to the users choice ?

    Something like this :

    Max31_0-1690804299272.png

     

    Seems complicated to me but we never know 🙂 

     

  • ManishSolanki Profile Picture
    15,089 Super User 2025 Season 2 on 31 Jul 2023 at 11:11:32
    Re: How to write multiple choice answers in html ?

    Hi @Anonymous 

     

    One workaround is to join the choices with comma (,) and then add that single string in the html code. To make a string for multi choice field, pls follow the below steps:

     

    1. Use the "Select" action, to make an array of choices, here 'MultichoiceCol' is the field in SharePoint list:

    ManishSolanki_0-1690801374253.png

     

    2. Next, press "Switch to text mode" button present on the right side of "Select" action:

    ManishSolanki_1-1690801455648.png

     

    3. Set the multichoice column value in the Map textbox from the Dynamic content:

    ManishSolanki_2-1690801608359.png

     

    4. Now, add a Compose action and write an expression using join() function to make a single string. The expression needs to be put in the expression window as shown below:

    ManishSolanki_3-1690801715810.png

    Expression used with join() function:

    join(body('Select'),', ')

     

    The output of the compose action will give a string that contains are the selected choices separated by comma (,). This can be used in another in html code for showing the values of multiple-choice field.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 736 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 396 Moderator

#3
Power Apps 1919 Profile Picture

Power Apps 1919 339

Last 30 days Overall leaderboard
Loading started