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?