November 20, 2024

Microsoft Forms is a great way to collect user information, but it’s not a great place to keep information. It would be best to keep the replies in another, more permanent solution, like SharePoint. Power Automate helps by providing the “When a new response is submitted” trigger to catch all submissions and parse them.

Let’s explore this a bit further in the section.

Where to find it?

You can find it in the Forms section.

Usage

You only need to point the trigger to your form, and you’re good to go.

You can provide an ID, but I would strongly advise against it. If you can’t see the Form in the list, something’s wrong.

Outputs

The trigger returns a lot of information in a JSON format, although the conversion from JSON is done automatically for you. Here’s an example:

{
    "headers": {
        "Connection": "Keep-Alive",
        "Expect": "100-continue",
        "Host": "<redacted>",
        "X-CorrelationId": "<redacted>",
        "Content-Length": "259",
        "Content-Type": "application/json; charset=utf-8"
    },
    "body": {
        "webhookId": "<redacted>",
        "eventType": "ResponseAdded",
        "resourceData": {
            "formId": "Qm32rhvlGAeYiBIM5OXiIjeRobZjKhNHs7kaQ7pHOftUREtWOEs2UEwyTjNEAVRYRjlPWVRaMTVZUS4u",
            "responseId": 3
        },
        "eventTime": "2021-08-25T13:53:37.3238526Z"
    }
}

As you can see, there’s no information, but we get what we need. The “formId” and the “responseId”. After that, we can call the “Forms Get Response Details” Action.

Microsoft decided to keep things separate, and we can understand why. Responses could be pretty big, so the trigger will be cumbersome if it contains all details. Also, it’s less frequent, but you could want to catch the trigger but don’t need the information of the reply. For example, to warn someone that there’s a new submission.

Limitations

You can consider this a limitation or work as intended, but the “When a new response is submitted” trigger will only return IDs, not information regarding the answer. You have the “Forms Get Response Details” action that will fetch the information.

Recommendations

Here are some things to keep in mind.

Never provide the ID.

It’s a personal opinion but never provide the Form’s ID in the “When a new response is submitted” trigger (or any other for that matter). IDs can change, and selecting them from a list ensures that:

  1. If the ID changes, your Flow will continue to work.
  2. The connection and permissions are correct. So if you see the form in your list, there’s a good probability that all will work correctly.

Never hard-code IDs in your Flows unless you have a good reason to do it, and if you do, please document it extensively so that other people will understand your mindset.

Name it correctly

The name is super important in this case since we’re getting the answer from a form between potentially a bunch of them. Always build the name so that other people can understand what you are using without opening the action and checking the details.

Always add a comment.

Adding a comment will also help to avoid mistakes. Indicate the form you’re fetching information from and what you want to do with the information. Knowing your intention from the beginning is important to enabling faster debugging when something goes wrong.

Back to the Power Automate Trigger Reference.

Photo by Manish Upadhyay on Unsplash

Manuel Gomes

I have 18 years of experience in automation, project management, and development. In addition to that, I have been writing for this website for over 3 years now, providing readers with valuable insights and information. I hope my expertise allows me to create compelling, informative content that resonates with the audience.

View all posts by Manuel Gomes →

Leave a Reply

Your email address will not be published. Required fields are marked *

Mastodon