cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TomHughes
New Member

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
Community Support

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
Community Support

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 Helper I
Helper I

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
Frequent Visitor

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
Frequent Visitor

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

<deleted>

Basic_User007 Kudo Kingpin
Kudo Kingpin

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
Regular Visitor

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
Frequent Visitor

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
Regular Visitor

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (8,436)