SOLVED

Some Form questions are getting brackets [ ] around answers, \n at the end, and/or <br> at the end.

Copper Contributor

I have Form that triggers a flow when submitted. That flow puts the Form data into a SharePoint list. There's a couple questions on the form that consistently get brackets ["answer"] around the answer and sometimes the same question will have the brackets and a \n at the end like ["answer\n"]. There's another question that inconsistently gets a <br> put at the end of the answer answer<br>. I've tried deleting the questions with the problem(s) and re-creating them, but the issue persists. The problem seems to lie within Forms and not Flow or SharePoint because when I check the response details within Forms I see answers getting the extra stuff it shouldn't get. Here's some screenshots:

Question and answers in Forms:

What my questions look likeWhat my questions look like

 

The way the data submitted into a SharePoint list:

This is data submitted into SharePointThis is data submitted into SharePoint

 

Raw input in Flow:

Here is the raw inputHere is the raw input

 

Any ideas whats causing this?

5 Replies

@src2021 that's how the flow in Power Automate deals with multi-choice answers from the form. I'll post up the way to deal with that asap.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliottare you still planning on following up with another post? 🙂

best response confirmed by src2021 (Copper Contributor)
Solution

@src2021 My apologies for the delay, I got horribly tied up last week with testing & delivering a Power Apps app before our company closed for Christmas.

 

In this example our form is as follows and allows the user to register for 1 or more events:
0-Form.png

 

As normal in the flow, start with the Forms "when a new response is submitted" trigger and the "get response details" action. 

 

1-Flow.png

 

Save it at this point and run it. You will need to get the id of the question where you were asking the multi-choice question in the form. Copy that ID.

 

1a-Flow.png

 

Next, add a Compose action and in the expression tab enter the expression below, changing my question  ID to your one that you've just copied. The expression will strip out the brackets and quotes and replace them with nothing:

 

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

2-Flow.png

 

Then you can just create the item in your list, using the outputs of the compose above:

3-Flow.png

 And this is the result.4-SP-list.png

 

Come back with any questions about this.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott 

 

I know this is late to the party, but I don't know where to find the question ID. Could you please tell me where that is?

1 best response

Accepted Solutions
best response confirmed by src2021 (Copper Contributor)
Solution

@src2021 My apologies for the delay, I got horribly tied up last week with testing & delivering a Power Apps app before our company closed for Christmas.

 

In this example our form is as follows and allows the user to register for 1 or more events:
0-Form.png

 

As normal in the flow, start with the Forms "when a new response is submitted" trigger and the "get response details" action. 

 

1-Flow.png

 

Save it at this point and run it. You will need to get the id of the question where you were asking the multi-choice question in the form. Copy that ID.

 

1a-Flow.png

 

Next, add a Compose action and in the expression tab enter the expression below, changing my question  ID to your one that you've just copied. The expression will strip out the brackets and quotes and replace them with nothing:

 

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

2-Flow.png

 

Then you can just create the item in your list, using the outputs of the compose above:

3-Flow.png

 And this is the result.4-SP-list.png

 

Come back with any questions about this.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

View solution in original post