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

Translating a choice from a Form to a Choice in SharePoint list

I have a Microsoft Form which has a multiple choice question (multiple answers allowed), in this example:

Morning

Afternoon

Evening

 

In my SharePoint List, I have a column which is formatted as a choice with the exact same choices. In both the Form and the List multiple-answers is allowed.

 

I have a Flow which is grabbing the Form fill data and creating an item in the SharePoint list. The problem is the way it gets displayed in the list. If someone checks off both Morning and Afternoon in the form for example, what appears in the list is:

["Morning","Afternoon"]

 

I tried formatting the column as text instead of choice, but I get the same result.

 

If I manually enter an item in the list and check off those two what appears is:

Morning, Afternoon

 

Is there anyway to work the Flow so that the result is clean like that?

 

Thanks in advance.

15 REPLIES 15
efialttes
Super User
Super User

Hi!

Great article here explaining the exact same scenario you have:

https://365basics.com/microsoft-flow-populate-a-multi-choice-field-in-sharepoint/

Please read it carefully, since it starts explaining how SP multichoice works from Flow perspective, then introduces how Forms multichoice works from Flow perspective

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Thank you for that. I'm having a super hard time getting it to work though, probably because I dont fully understand the mechanics of it.

 

It think I have it right, but its giving me an error:

 

ExpressionEvaluationFailed. The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@outputs('Get_response_details')?['body/re275778528fd421da8e51ae202340ef2']' is of type 'String'. The result must be a valid array.

 

Here is what I have:

 

Capture.JPG

 

When on Monday is the question on the Form which is multiple choice (morning, afternoon, evening).

@BFlow 

 

Please put your expression in Dynamic expression text like this-(my expression is random one, not related to your problem)

Hardesh15_0-1600453299065.png

 

Thanks

Hardesh

 

Thank you. I've made that change, but get the same error.

@BFlow 

 

Please share your flow running screen with error and all details.

 

Thanks

Hardesh

I think my problem is the first item in the Apply to each ("Select an output from previous steps"). In the example, it shows "List of Response...". Thats not a dynamic content piece I've ever seen (and on the face of it, wouldn't the Get Response Details have to come first in order to get a list of responses anyway?!?).

 

What I've been putting in there instead is the multiple choice question from the form, and the error is telling me that is not an array.

 

Capture2.PNG

@BFlow 

 

Now share your action details " format output......6" with screen. So that i get to know that what are you passing in loop?

 

As error clearly said expression is string it must be of collection type like array.

 

Thanks

Hardesh

Yes, going by to code referenced by the error (@outputs('Get_response_details')?['body/re275778528fd421da8e51ae202340ef2']), it seems to be referring to the When on Monday dynamic content I am putting at the start. I just dont know what else I could or should be using there.

 

Capture3.PNG

@BFlow 

 

 

In your MS Form, what is type of question "when on monday" means- single text, choices etc. One suggestion, use compose just above the loop and supply same input "when on monday" and share compose output. In this way we will get to know what kind of value in "what on monday" is coming.

 

Thanks

Hardesh

The question on the Form is multiple choice (multiple answers allowed):

formsquestion.PNG

If I put a Compose right before the operation, and put that question in, here is the result from a test run where a person selected Morning and Afternoon as their answer:

 

compose.PNG

@BFlow 

Now put apply to each action and supply output of this compose in value because it is in array. Inside apply to each use append to string variable and pass current value with comma and space  as value so that each value append as you want. Before doing append to string pls initialize a variable of type string.

If you face any difficulty i will post screen tomorrow.

 

Thanks

Hardesh

I'm still lost. By all accounts the Apply to Each is getting an Array at the start, but the error I keep getting is that it is not an Array...

@BFlow 

 

please follow steps- expression in compose-

split(replace(last(split(first(split(outputs('Get_response_details')?['body/r54b3ab3529e64cb69eb793f9e981b93f'],']')),'[')),'"',''),',')
i have Question- with three options-option1, option2 & option3
and output of compose passed as value in loop.

Hardesh15_0-1600694444566.png

Output-

Hardesh15_1-1600694495194.png

 

Thanks

Hardesh

In your example you are using type string. According to the link given earlier it should be array?

 

@BFlow 

If you use append to array variable then your output will have brackets and double quotes which you can manipulate later via converting it into string . So no need of using append to array here.

Thanks

Hardesh

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,371)