Categories: Power Automate
*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***

Recently I was asked if I had a list of all of the Forms Pro related expressions I had used in Power Automate flows I’d created. A kind of ‘library’ or ‘cheat sheet’ so to speak. I hadn’t so figured it was as good a time as any to create something. So, here are some of the expressions I have used to get the most out of using Forms Pro. It’s all about that Power Automation!

Get Response Details

This is is perhaps the most common one. When using the Microsoft Forms Connector, and the Get response details action, you need to put the Response Id using the source response identifier. However, we need to parse this value from a string into an integer value. I’ve used this in a ton of blogs, but here is the first example where I used it.

int(triggerBody()?['msfp_sourceresponseidentifier'])

Counting Number Of Surveys

If you are trying to limit the number of surveys you send out to your customers, checking how many you’ve sent is important. This expression is something you would use to count the number of a list of records from a prior action step in your flow. I used it here to control the number of surveys sent to a contact.

length(body('List_Related_Survey_Responses')?['value'])

Using The Sentiment Values

When analysing the responses from your surveys, sentiment is an important indicator to see just how happy our customers are. The sentiment is tracked on text questions and shows Negative, Neutral or Positive. We can use these to then populate fields on a Contact, related Case, or in this example, create Custom Insight cards for the feedback. I used emojis in this, but if your life doesn’t need them, I guess you could leave them out πŸ˜‰

if(equals(triggerBody()?['msfp_sentiment'],647390002),'???? Negative',
if(equals(triggerBody()?['msfp_sentiment'],647390001),'Neutral',
'???? Positive'))

Using NPS Feedback

As above, we can get an idea of just how happy someone is from their survey response. If you have added a Net Promoter Score question to the survey, an NPS Score value will be stored against the Survey Response record. We can use that value to set the Contact record as a Promoter, Passive or a Detractor depending on their response. We can also use it to create Custom Insight cards as above.

if(greaterOrEquals(triggerBody()?['msfp_npsscore'],9),'???? Promoter',
if(lessOrEquals(triggerBody()?['msfp_npsscore'],6),'???? Detractor',
'???? Passive'))

Get Contact From Survey Response

If you sent out your survey invitation and used the Regarding field to link to a different type of record (the account or a case for example), you might still want to get the Contact when a survey response comes in. This record is automatically going to be linked to the Contact, but you just need to use the activity party entity to do so. For this we can use a list records step, then check the participationtype mask is 1, which is the sender of the Survey Response. From there we can find the Contact.

_activityid_value eq @{triggerBody()?['activityid']} and participationtypemask eq 1

Get Contact From Survey Invite

As with the item above, we might have a need to get the Contact record from CDS that a Survey Invitation was sent to. This is very similar but instead of the participationtype mask being 1, it’s 2 which pulls back the To Recipient on the Survey Invitation entity. I used it here to send reminders when a survey response wasn’t received.

_activityid_value eq @{items('Apply_To_Each_Survey_Invite')?['activityid']} and participationtypemask eq 2

Trigger Flow For A Specific Survey

As laid out in this post, we can set a trigger condition on the flow, so that it only runs for a specific Forms Pro survey. By adding the code below to the initial trigger step in your flow, you can make sure it’s not running all the time.

@equals(triggerBody()?['_msfp_surveyid_value'], 'your-unique-survey-id')

If you want to include more than one survey in the trigger condition, you can modify the expression slightly as you see below:

@or(equals(triggerBody()?['_msfp_surveyid_value'], 'your-first-unique-survey-id'),equals(triggerBody()?['_msfp_surveyid_value'], 'your-second-unique-survey-id'))

Another idea along these lines was sent to me by Greg Owens, a fellow consultant. A great idea to combine using variables with the trigger condition and trigger the flow to run ONLY IF the survey response contains a specific variable. Thanks for sharing Greg!

contains(msfp_embedcontextparameters, '"SomeVariable":"true"')

What about you? Any more to add to the list?


Check out the latest post:
Split Your Audience By Number Or Percentage In Customer Insights - Journeys


This is just 1 of 480 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.




7 thoughts on “Power Automate Expressions To Use With Forms Pro

  1. Hi Megan!

    Is it possible, through either expressions or another method, to retrieve variables form a form? Specifically variables you set when you send the survey and that the responder didn’t provide? Tried using variables(‘surveyID’) for example, but it gives an initialization error.

    Thank you, your content is great!

    B

    1. Hi B. Yes, it is possible, you can pass them through when you create a survey invitation or send a survey using Power Automate. You can add the variables in Forms Pro, then populate those variables within your flow. Those same variables come back in with the response automatically. Here is an example of that: https://meganvwalker.com/updating-records-from-responses-using-piped-variable-parameters/ – I also have a few events coming up where I am doing presentations exactly on the topic of variables within Forms Pro. The next one is in London, but I don’t know if you are in the UK, but then I should have one coming up online soon too.

    2. Megan,

      Thank you so much for responding. I’ve read that blog post and reviewed a video you posted on the subject, however I’ve not yet had success with it myself. It seems that the context data portion of your example is depending on the Forms data being stored in MS Dynamics? For me, I need to read the data back in the response and then insert it into a SQL server record. I’m going to assume that I’m just missing something and will hit it again with fresh eyes. Currently I’m forcing the user to copy/paste a projID that I can provide them in a question, but they need to provide in the response for me to read back. I’m hopeful about what you’ve suggested.

      Unfortunately no, not in London currently, will be visiting there and throughout Scotland this summer though (can’t wait :D).

      Cheers and thanks again for your feedback and any other advice you have. Much appreciated.

    3. Hi Brandon, I have a post coming out tomorrow that shows how to get the Context Data without needing Dynamics (although it’s really a model-driven Power App that you would need, not exclusively Dynamics 365). My example will show how to add responses to Excel, but this could apply to SharePpoint, SQL server record, anything really. I hope it will be helpful!

  2. Hi,
    Is it possible to use a Custom Value to retrieve the Form Id for the “Get Response Details” action? I want to use the same flow for several surveys, so selecting a Form name from the dropdown is not an option.

    1. Hi Anders, no, it’s not possible at this moment in time. It’s certainly a downside, and I agree would be a good option to have. However, it’s not something you can do with the current connectors.

Comments are closed for this post.