Forum Discussion
helpmepl5
Feb 21, 2024Copper Contributor
Error with 'Upload File' field from MS Form to SP list
New to Power Automate - I have tried a few answers that I've found on here but nothing is working, please help!
I have made a simple flow to collect answers from an MS form submission and create an item in a SP list. This is my flow:
One of the fields on the form is 'Supporting Documents' where users can upload a link. The question type on the form is the 'Upload File' option. In my SP list, I have a column which is of the hyperlink type of column. In the 'Create Item' action, I have selected the two corresponding fields:
When testing the flow, I receive an error with 'Create Item', with the error shown below:
How can I populate my SP list with the link uploaded in the form, just as I can for the other answers in the form? Thank you in advance!!
- SanthoshB1Bronze Contributor
Check the below steps and let me know if this works for you.
1)Start by setting up a trigger for your Microsoft Form using "When a new response is submitted".
2)Retrieve the details of the form response using the "Get response details" action. This action helps to retrieve the individual answers submitted by the respondent.
triggerOutputs()?['body/resourceData/responseId']
3) Add action, "Initialize variable" and create variables with array type and store the upload type questions in the value.
4) Then loop the questions to get a attachments and Include action, "Parse Json" to extract the link from Json
items('Apply_to_each_2')
outputs('Each_Question_Files')
You can use the below schema to parse json.
{
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"link": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {},
"size": {
"type": "integer"
},
"referenceId": {
"type": "string"
},
"driveId": {
"type": "string"
},
"status": {
"type": "integer"
},
"uploadSessionUrl": {}
},
"required": [
"name",
"link",
"id",
"type",
"size",
"referenceId",
"driveId",
"status",
"uploadSessionUrl"
]
}
}
5) As a final step, add action "Create Item" in SharePoint to create the item. Use the expression,
first(body('Parse_JSON_2'))?['link'] to upload the link in the hyperlink column.