In the realm of Microsoft Forms and Power Automate integration, “When a new response is submitted” connector serves as a reliable tool for triggering actions upon the submission of a single form response. However, a notable limitation arises when attempting to capture responses from multiple Microsoft Forms simultaneously. Considering this challenge, there emerges a need for a more efficient approach. Hence, we present a method to streamline the retrieval of responses from multiple Microsoft Forms within a single Power Automate flow, enhancing productivity and optimizing workflow management.
Let’s look at how we can achieve tracking of data through multiple form submissions using the scheduled power automate flow with below example:
Form1:
This Form is used for gathering some information like Name, Gender and Date of Birth as a response.
Form2:
This Form is used for gathering some information like Name, Gender and Date of Birth and additional Details as a response.
Create Form Details table In Dataverse where we need to store Form ID and Form Name Into it.
I’m utilizing the Forms API and specifically employing the responses method to achieve the desired functionality.
The overall flow looks as below after completion of the setup:
Let’s check step by step:
Step 1. Add a Recurrence trigger action.
Set the interval and frequency to 1 x Day. Make sure your start time is at the end of the day.
Step 2. Add a Get my profile (v2) action.
To send the http request to microsoft.form.com, we need form owner user id, which will be used in step 5. For getting the owner id, use the below action “Get my profile(V2)”
Step 3. Add a Initialize variable action.
Select type String. Call it Tenant ID. Add your Tenant ID as the value.
Step 4. Fetch Form Id From Dataverse.
Step 5. Add a Send an HTTP request to SharePoint action.
Make sure you use the GET method and the https://forms.office.com as a custom value for the Site Address. Use the parameters/uri from the code snippet below.
The Uri uses a tenant id, user id and form id. Update to your own values where appropriate.
Step 6. Add a Filter Array action.
Use the body values of the output of the Send an HTTP request to SharePoint action in the From field. Check if the submitDate is equal to today. Grab the expression with utcNow function and formatdate functon from where field in the code snippet below.
{ "inputs": { "from": "@outputs('Send_an_HTTP_request_to_SharePoint')?['body']['value']", "where": "@equals(formatDateTime(item()?['submitDate'], 'dd-MM-yyyy'), formatDateTime(utcNow(), 'dd-MM-yyyy'))" }, "description": "formatDateTime(item()?['submitDate'], 'dd-MM-yyyy'), ", "metadata": { "operationMetadataId": "36aec1e3-ac76-4369-ab73-7f155c18da9d" } }
Because we would schedule to run the flow at of the day you would only get today’s entries
Step 7. Fetch Only Answer From Filter Date.
In the From use the Body of the Filter Array action. In the Map use the expressions select field in the code snippet below.
The item answers field is converted with a json function. After that the correct answer1 value is retrieved with an index [0] or [1]. You might need to use different index numbers dependent on the order of your questions.
Step 8. Convert This String Into Json.
For Convert I use Below Code:
json(outputs('Get_Answer_From_Filter_Data'))
Step 9. Add This Response To Dataverse Entity
For adding response into Dataverse table, use “Dataverse Add A Row Action”.
For adding specific value into Specific column use below code:
Ex:
Name: outputs(‘Array_Of_Response_Details’)[0]?[‘answer1’]
here we should get first column of answer from output of Array.
Form 1 And Form 2 Have Total 5 Number Of Response Submit Today.
Form1:
Form2:
After the power automate has been triggered, I have total 5 numbers of record into Dataverse Entity.
I hope this helps!!
Stay tuned for more exciting features and remember that Inkey Solutions Pvt. Ltd. can help you automate many processes like this one!
© All Rights Reserved. Inkey IT Solutions Pvt. Ltd. 2024
Leave a Reply