Power Automate Expressions To Use With Forms Pro
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
What about you? Any more to add to the list?
This was originally posted here.
*This post is locked for comments