Triggering Power Automate For A Specific Survey

3 minute read

Information in this article was accurate at the date of publication.

If you have been using Forms Pro for any length of time, you should know that the power of the survey tool lies in the ability to run flows to send survey invitations and to run flows when survey responses are received. Your flows to send out the invites should be set up when specific things occur in your databases (CDS/D365CE) or SharePoint lists, but what about when responses are received? Do you really want those flows running potentially thousands of times? Let’s look at how we can add trigger conditions to make sure we only run a flow when the survey response is linked to a specific survey.

In the past, when creating flows to run when a new survey response is received, I have done something similar to the flow below, getting the survey the response is related to, and then checking against the NAME or the ID of the survey. While these work, it does mean the flow runs EVERY SINGLE TIME there is a new response, regardless of the survey.

Instead, we can add in a trigger condition. Add the usual trigger of when a new Forms Pro survey response is created. Then, click on the ellipsis at the top right of the flow step, and then on Settings.

At the bottom of the settings area, we can add in a trigger condition. We are checking to make sure that the survey id from the survey response equals a specific id. If it doesn’t the flow will not even run.

Here is the expression needed.

@equals(triggerBody()?['_msfp_surveyid_value'], 'ef893088-9046-ea11-a812-000d3a86d545')

So how do we even get the id? If you have access to a model drive Power App (D365CE, naked CDS), you can navigate to your Forms Pro survey records, then use the Export to Excel option and download the list of records. From there, unhide the first few columns and you can access the id you need for the expression above.

What if you don’t have access to a Power App and can’t get to the ID? Simple. Create a new flow in Power Automate, and add your initial trigger step that will run when a new Forms pro survey response is created. Add in a compose action, and use the Survey (Value) from the trigger. Now go ahead and fill out your survey.

Once you have completed the survey, open up the flow which should have run successfully. From the Compose step, you now have access to the ID you need. You can remove the Compose step now if you wish, and just continue on with the rest of your flow, and add in whatever it is you want to do.

Should you want to have a flow trigger on one or more various surveys, you can use @or at the start and combine a few values in the trigger condition.

@or(equals(triggerBody()?['_msfp_surveyid_value'], 'ef893088-9046-ea11-a812-000d3a86d545'),equals(triggerBody()?['_msfp_surveyid_value'], '26301e92-7829-ea11-a810-000d3a86d545'))
Megan V. Walker avatar

14 responses

  1. Triggering Power Automate For A Specific Survey – 365 Community

    […] Triggering Power Automate For A Specific Survey – Megan V. Walker […]

  2. Henrik Kappel avatar
    Henrik Kappel

    Smart! Thanks again!

    Here is a tip to easily get survey GUID:
    – install the Chrome extension ‘Level Up for Dynamics 365’
    – open the specific survey record in chrome
    – hit the Level Up icon ans select the option ‘GET RECORD ID’

    This can be done with any record in Dynamics 365 Sales

    1. Megan V. Walker avatar
      Megan V. Walker

      Hi Henrik! Yes, great if you have Dynamics 365 and use Chrome! Thanks for letting others know about it too!

  3. justin avatar
    justin

    Really good article Megan – I have previously done what Henrik has getting the GUID using level up but I really like like the idea of using a name of survey vs the GUID as if your deploying Flow’s to different environments you will have to go in and update the GUID each time.

  4. Ahmad Khalil avatar
    Ahmad Khalil

    Thanks Megan, this solved the problem of failed runs. 🙂

    1. Megan V. Walker avatar
      Megan V. Walker

      Perfect. ????

  5. Tomas Spångberg avatar
    Tomas Spångberg

    Thanks for a great article!
    One question: Why don’t use “msfp_sourcesurveyidentifier” (FormID) instead of “_msfp_surveyid_value” in the Trigger condition?
    It’s much easier to find, or do I miss something?

    Br // Tomas

    1. Megan V. Walker avatar
      Megan V. Walker

      Hi Tomas, in theory, you could use either of those fields!

  6. Welly Lee avatar
    Welly Lee

    you can use the following trigger for survey identifier (and get the survey ID from survey URL) @equals(triggerBody()?[‘msfp_sourcesurveyidentifier’], ‘UMck_jU0zkqaWu5hQY9ZJUXAPRqr8xtIuKFuOHsg9S1UMjA3OTE2OUlXWTBGRTJENVdDUlBTVjhGRC4u’)

    1. Megan V. Walker avatar
      Megan V. Walker

      Thanks Welly! 😀 Yes, that’s how I would do it now too! Much easier and you don’t have to go hunting for an ID. Thanks for the comment!

  7. Andrew avatar
    Andrew

    Hi,
    If you are using the Forms Get Response details in a flow and manually select a form, you get the details in a easy to read format, but if you select the Form using the custom value, you get an output that gives you the answers but only the Id to the questions. Is that by design and can you get around that?

    You might have several survey’s on the go and don’t want to have to create a Flow for each one.

    1. Megan V. Walker avatar
      Megan V. Walker

      Hi Andrew, it is by design… and for me, it’s a bit clunky and not great… I agree with you. I would check out this post as at least it shows you how to get the question text for each answer: https://meganvwalker.com/sending-notifications-from-the-details-of-survey-responses/

  8. Divya Joshi avatar
    Divya Joshi

    Hi, Megan. I wanted to automate surveys using Power automate and Microsoft Forms (not Pro)- Schedule and send out CSAT surveys automatically using recurring survey feature. Can I create the flow? Need your guidance.

    1. Megan V. Walker avatar
      Megan V. Walker

      Hi Divya, I am not sure if you can do that with regular Forms. Is there a recurring survey feature there? I don’t write about just regular forms. Sorry!

SUBSCRIBE TO GET CONTENT

Want more articles like this?

Choose the topics that interest you and get new articles delivered directly to your inbox.