*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***
If you are sending out surveys to gain feedback from your customers, it’s great to be able to generate the requests after each interaction you have with them. Or is it? If you send a survey request after every single case that’s closed, some of your contacts could end up with several survey requests each day. That could be a little annoying for them, so how can you control the number of survey requests that get sent? Let’s look at using Microsoft Flow to check how many they have responded to, and decide if we should email them again.
First we have our trigger, when a case record is updated using the CDS connector. Then we have a condition that checks the status reason value and make sure it equals 5, which is the Resolved Status Reason.
If Yes, we are going to get the Contact using the Get Record CDS action, and use the Customer (or Contact if you use that field instead) value from the original trigger on the Flow.
Now, this next part will need to be modified for your own needs. We need to get the date from the Last 7 Days in this example, so we only request someone fills this out once a week. You could change it to be however many days are important to you. We add in a Compose step and add in the expression below. -7 will count back seven days from today.
Next, we are going to list all Forms Pro survey responses for this Contact. So we do the CDS List records action and use a filter query to only find responses for a specified survey, that have a createdon date greater than the date in the Output step above. Finally, we want to find those where the respondent email address equals that on our Contact record.
msfp_sourcesurveyidentifier eq 'YOUR SURVEY ID' and statecode ne 2 and createdon gt OUTPUT and msfp_respondentemailaddress eq EMAIL FROM CONTACT
To find the survey id, use Advanced Find in your CDS model driven app, and add the Source survey identifier field to your results. You can then copy the id and use that in your query.
Now we are going to check the number of responses that have come back in our List survey responses step above. To do this we are going to add a Compose step and add in the Expression below.
Next we add a condition using the Output from our previous step. Here is where you determine how many surveys you want to stand. Your condition could be less than 2 or 3, or like this below you might only want to send one a week so we are looking for equal to zero.
If it’s not equal zero, they must have filled out at least on survey, so that’s a No, and we do nothing further. If it does equal zero, we look at the yes column and add a step to create our invitation using the Forms Pro connector, and then a step to send an email with the invitation link included.
Here we see part of a successful flow, where we see the date that was captured using our Last 7 Days Step, the output shows the date. Then we list the survey responses and the output shows 2.
So the invite and subsequent email are never created.
Here we see the number of responses is zero, so the invite and email are created and sent. This will help keep control of how many survey requests are sent out, and hopefully help you avoid frustrating your customers by sending them a request to provide feedback every single time!
Want to just watch how to do this? Check out the video below:
Check out the latest post:
Checking User Access To Model-driven Apps (D365 CE)
This is just 1 of 338 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.