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

Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

I'm totally new to flow so please bare with me... I've set up my first flow today. My objective was to get data from a MS form to a SharePoint list so I used the template an 90% of it was as expected. I found it straightforward to link fields from Forms to the columns in my SP list. So good so far, but then the data is coming from an multiple choice in Forms I'm getting ["Text"] in the SP List. I suspect it something really simple but it isn't obvious to me. Any ideas?MS Forms to SP via Flow tempalte.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

Hi @TomHughes ,

 

Do you want to save multiple selections from Forms to SharePoint list?

 

I have made the following flow for your scenario, please check it for a reference.

 

Add the trigger When a new response is submitted. In the form, I have a multiple selections enabled field.

 

Initialize variable, set its Name as Test, Type as Array.

 

Get response details. An Apply to each will be added automatically after you select the response Id.

 

Add a Compose action to remove all the special characters:

replace(replace(replace(body('Get_response_details')?['rb12b59186b54449d83e54595ebe4eb10'],'","','|'), '["',''), '"]','')

 

Add a Compose 2 action to split the previous output into an array:

split(outputs('Compose'),'|')

 

Add an Apply to each 2, select value from compose 2 output, add the action Append to array. Here, set its name as Test, Value as dynamic content Current item of Apply to each 2.

 

Under the Apply to each 2, add Compose 3 with the following code:

join(variables('Test'),',')

 

Add the action Create item to add the output of Compose 3 to corresponding column.

 

Images for your reference.

1.PNG2.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Community Support Team
Community Support Team

Re: Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

Hi @TomHughes ,

 

Do you want to save multiple selections from Forms to SharePoint list?

 

I have made the following flow for your scenario, please check it for a reference.

 

Add the trigger When a new response is submitted. In the form, I have a multiple selections enabled field.

 

Initialize variable, set its Name as Test, Type as Array.

 

Get response details. An Apply to each will be added automatically after you select the response Id.

 

Add a Compose action to remove all the special characters:

replace(replace(replace(body('Get_response_details')?['rb12b59186b54449d83e54595ebe4eb10'],'","','|'), '["',''), '"]','')

 

Add a Compose 2 action to split the previous output into an array:

split(outputs('Compose'),'|')

 

Add an Apply to each 2, select value from compose 2 output, add the action Append to array. Here, set its name as Test, Value as dynamic content Current item of Apply to each 2.

 

Under the Apply to each 2, add Compose 3 with the following code:

join(variables('Test'),',')

 

Add the action Create item to add the output of Compose 3 to corresponding column.

 

Images for your reference.

1.PNG2.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

PMac
Level: Powered On

Re: Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

@v-yamao-msft  I have the same issue and just trying your suggested workaround, however I am getting the this error in the first 'compose'.  

 

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2578': 'The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#replace for usage details.'.

 

Any suggestions?  Thanks

patspurrier
Level: Powered On

Re: Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

While the accepted solution will work, I feel obligated to reply incase anyone comes here looking for help with the same issue. @

 

 

replace(replace(replace(body('Get_response_details')?['r676aaefb8a4b4a6c81675db2517d6e1d'],'","',', '), '["',''), '"]','')

Just replace the "body('Get_response_details')?['r676aaefb8a4b4a6c81675db2517d6e1d']" with the dynamic content of the multiple choice response question.

 

 

Flow for forms.PNG

 

patspurrier
Level: Powered On

Re: Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

<deleted>

Re: Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

Thanks for sharing @patspurrier this worked perfectly for what I was needing - if only I had come across your post earlier. Will link this to the one I created 🙂 

AxeLode
Level: Powered On

Re: Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

Thanks for your example.  I'm getting close, but the multi choice field in my form is showing up as blank in my SharePoint list.  Could you show exactly what is in your replace function for the Fixed attribute.  I've not been able to interpret your instructions of 

"Just replace the "body('Get_response_details')?['r676aaefb8a4b4a6c81675db2517d6e1d']" with the dynamic content of the multiple choice response question"

 

TIA

patspurrier
Level: Powered On

Re: Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

@AxeLode,

This is exactly what is in my Fixed sharepoint field:

replace(replace(replace(body('Get_response_details')?['r676aaefb8a4b4a6c81675db2517d6e1d'],'","',', '), '["',''), '"]','')

After you paste this expression into the expression area, you'll have to modify it to point to your response. Just backspace out the "'Get_response_details')?['r676aaefb8a4b4a6c81675db2517d6e1d']", go to dynamic content and select your response, then click OK.

AxeLode
Level: Powered On

Re: Form to Sharepoint template - ["How do I get rid of the square bracket and quotation marks from my multiple choice options?"]

@patspurrier 

 

It appears I have multiple issues with my flow.  I was able to figure out what needed to be replaced in the formula, but I appreciate your response. 

 

It seems the only way I can get the multiple choice Form responses to display in my SharePoint list is to have the column configured as text.  I would have thought the proper format would be multiple choice, choices defined the same as in the Form, and checkboxes selected.  Any idea why it only works when the column is configured as text?

 

TIA, again.

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: 92 members 5,420 guests
Please welcome our newest community members: