If you are responsible for communications sent to your customers by your organisation, making sure people’s communication preferences are adhered to is likely top of mind. At the bottom of every Forms Pro survey email that goes out is an Unsubscribe link. This allows the recipient to stop receiving emails requesting them to complete a survey. What happens when it’s clicked on? Let’s find out!
First, they are taken to a browser which asks them to confirm if they wish to unsubscribe and stop receiving emails. They then need to click again to unsubscribe.
This will then show that they have successfully unsubscribed. They have the option to subscribe again if they wish.
In CDS a new Unsubscribe record is created for the email address (not the Contact/Lead). If the same person is sent a survey invite (either directly from Forms Pro or via a Microsoft Flow) the email will not be sent and the Survey Invite activity status will be set to Unsubscribed. However, we can improve on this and make it clearer to users of a CDS App (Dynamics 365 Customer Engagement or otherwise) what the situation is.
First on the Contact entity we add a new two option field similar to the other Contact Preferences fields. I’ve called it Survey Invites and set the values to Allow and Do Not Allow to fit in with the other fields in this section.
Now let’s look at the Flow. We trigger it when a Survey Invite record is created. Then we add a condition and check to see if the Survey Invite Status is Unsubscribed. This value is 647390001.
If it is, we will do a few things to help update that Survey Invite record. Let’s get the name of the survey that was sent. We can do that with a Get record step and get the Forms Pro Survey using the Survey id field from the Survey Invite trigger. Next we will add an Update record step and update the Survey Invite record using the activity id from the Survey Invite trigger. You can put what makes sense for you but in this example I have updated the subject to show UNSUBSCRIBED – INVITE NOT SENT – and then added the name of the survey. I’ve also set the Activity Status Value to Canceled so we know it didn’t ever go out.
Now let’s update the Contact record so we can indicate they have opted out of surveys. Use a List records action from the CDS connector. We are going to use the activityparties entity. However, you can’t find that in the Entity name dropdown. Instead, scroll to the bottom and click on enter custom value, then type it in like you see below. The filter query will be _activityid_value eq and then the Activity id from the original trigger step. The survey invite will only be linked to one record which should be your contact.
Now we will use a Get record step and get the Contact using the Party value from the list activity parties step above. Then we use an update record step and update the Contact record using the Contact Id from the get Contact step. Set the Survey Invite field you added to the Contact and set it to Do Not Allow (or Yes depending on how you set up your field). This will now show that the Contact has opted out of getting surveys.
Ok, so that’s taken care of if someone has unsubscribed… but what if they resubscribe? The Unsubscribe record is just deleted. So although any new survey invites will be sent, the Contact record will still have Survey Invites set to Do Not Allow. So our No condition will take care of that. We will do the same thing again and do a Get Activity parties action, then a Get Contact action using the Party value.
Our next step is to add a condition and check to see if the Survey Invites field is set to true – meaning it’s been set to Do Not Allow. If yes, we will update the Contact record and change it back to Allow. If no, we won’t do anything.
So now we get a nice looking survey invite when someone has unsubscribed. It’s clear and obvious to see what has happened.
This then shows up on a timeline, so again it is clear and obvious what happened with this survey invite.
And finally, we can see the Contact has their preferences updated accordingly!
Want to just watch how to do this? Check out the video below: