cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Reknaw
Helper I
Helper I

MS Forms Multiple Choice to SharePoint List - Create a new Item per selection

Hello again my favourite community!

I am creating a Form that is designed to output to a SharePoint list, at the moment looks like:

When a new response is submitted -> Get response details -> Create item.

Works great... but, the output for multiple select from the form sucks. So I tried fixing it, but the one user guide I could find was incorrect. Then I asked, should this be a line per selection? The answer was yes.

So, how do I split the Get response details so that it creates a new item for every response?

I'm still fairly new to Power Apps, so I'm sure it's easy, I'm just inexperienced...

2 ACCEPTED SOLUTIONS

Accepted Solutions

@edgonzales it comes out like:

["A","B"]

 

I added:

replace(replace(replace(body('Get_response_details')?['r96c7df6de2044f179b567c18b899ecee'],'","','|'), '["',''), '"]','')
 
Then:
split(outputs('Format_the_Output'),'|')
 
Then Apply to each, but the multi choice field I set to "Current Item" and it worked! Thanks for that. All too easy!

View solution in original post

v-bacao-msft
Community Support
Community Support

 

Hi @Reknaw ,

 

It is assumed that the name of the choice field in the list and the choice in the Forms are both Status, and they both support multiple selections.

 

You can refer to the following methods to configure Flow.

188.PNG189.PNG

 

Best Regards,

Community Support Team _ Barry
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

24 REPLIES 24

@Reknaw 

Hey there.  What does the output look like when multiple things are selected?  It may be that you can use the Split() function and then an Apply to Each loop to cycle through each 'thing'.

 

-Ed

 

If you liked this reply, please give it a thumbs up! 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.

@edgonzales it comes out like:

["A","B"]

 

I added:

replace(replace(replace(body('Get_response_details')?['r96c7df6de2044f179b567c18b899ecee'],'","','|'), '["',''), '"]','')
 
Then:
split(outputs('Format_the_Output'),'|')
 
Then Apply to each, but the multi choice field I set to "Current Item" and it worked! Thanks for that. All too easy!
v-bacao-msft
Community Support
Community Support

 

Hi @Reknaw ,

 

It is assumed that the name of the choice field in the list and the choice in the Forms are both Status, and they both support multiple selections.

 

You can refer to the following methods to configure Flow.

188.PNG189.PNG

 

Best Regards,

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

How do I get this to work if there are multiple multi-choice questions on the form?  For example, on my Form I have a multi-choice for "Departments Engaged" and "Topics Discussed" but the above is putting the data from "Departments..." into both "Departments…" and "Topics..." SharePoint list columns...

 

Where do I make the break to put them into correct columns?

SOLVED

This is almost working for me. However, when it pulls into SharePoint, it doesn't recognize it as one of the choices in the column. It looks like what it's doing is pulling an ID number of -1 for every choice.

Edit: Nevermind. I was adding the values to the wrong column. 😅

Can you share the how you solved this, as I have the same question?

Hi @sazza - sorry for the late reply.

Once you get the response details, create a Compose and add a function for:

replace(replace(replace(body('Get_response_details')?['[RESPONSE]'],'","','|'), '["',''), '"]','')
 
Then another Compose for:
split(outputs('Format_the_Output'),'|')
 
Then when you Apply to Each for the Create Item, make sure the 'Select an output from previous steps' is set to 'Outputs' from the second Compose.
 
Hope that helps? Happy for you to share a screen shot.

Greetings! This does not allow me to select the Variable in the Create item connector. Any ideas?

Greetings. This does not allow me to select the Variable in the Create item connector. Any ideas?

GrandMoffReknaw
Regular Visitor

If you can share a screen shot, that would help. But I usually initiate all variables straight after the start trigger. I find it's easier to have them all in place for when you need them later on.

Hi @v-bacao-msft 

I was just trying out your solution, but I am getting an error back. "Item could not be created"

What am I doing wrong? I double checked that my column was set to multichoice.

I tested it without the variable and it worked... so I definitively did something wrong with the variable.

 

Fernanda_0-1621460212591.png

 

danishpowerapps
Advocate I
Advocate I

Forms multiple choice --> Sharepoint List choice column, look no further
John Liu has the solution:
https://www.youtube.com/watch?v=dNZydb1QH4o&ab_channel=JohnLiu

Thanks. The video explained this perfectly. 

This is fantastic.  Works perfectly.  I'm just wondering how it could be modified for multiple choice fields in your List and Form?  Say a Status and a Product choice field.  I assume create two Initialize Var: ChoiceValue1 and ChoiceValue2, but I'm completely lost

See this video - build a Select statement for each of the choice arrays (from Forms) that you want to transport to the Sharepoint List item: https://www.youtube.com/watch?v=dNZydb1QH4o&ab_channel=JohnLiu

cds63
Frequent Visitor

I tried building a second Select Statement for a second choice array (from Forms), but the Flow errors on the 2nd Select statement.   The error returned when testing is:

 

Unable to process template language expressions in action 'Select_2' inputs at line '0' and column '0': 'The template language function 'json' parameter is not valid. The provided value 'John Smith' cannot be parsed: 'Unexpected character encountered while parsing value: B. Path '', line 0, position 0.'. Please see https://aka.ms/logicexpressions#json for usage details.'.

 

cds63_0-1642640018256.png

json(body('Get_response_details')?['rf815334523e54f0f9cc47b0de9aa13cb'])

json(body('Get_response_details')?['ra94901a53fc847e2bd64690e452fd2e8'])

 

Any help is appreciated.

cds63
Frequent Visitor

ok, I seem to have figured out the problem, but still need help.  The Select statement works when you have multiple selections from a Choice field in the Form/List.  My second Choice field only has a single result.  This second Choice result will not transport to the Sharepoint List.

 

Results of Choice 1:  Product 1;Product 2;

Results of Choice 2: John Smith

 

cds63
Frequent Visitor

for clarity, the multiple choice selection Product 1 and Product 2 transport to the MS List, but the single choice section, for Choice 2 will not.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,270)