From Cameron Farrier-Mcgoldrick: Suppress Survey Invitations based on Criteria


Salesforce Feedback Management provides ‘Survey Invitation Rules’ feature OOTB which lets admins define rules and conditions under which survey invitations can be sent.  

This is equivalent to configuring a survey trigger based on triggering conditions.  Here is an example where a survey invitation is sent out to capture additional information everytime a case is created or updated.  

Problem Statement

What if there are additional requirements to control the frequency of the survey invitation to be sent.  A frequent use case we keep hearing is “How can I suppress survey invitations if there was already an invitation sent in the last 2 days?”

How do we solve such use cases?

The limitations with survey invitations feature is we cannot add advanced filtering conditions. To overcome this the recommendation is NOT to use “Survey Invitation Rules”, rather use custom Flows.

Solution Approach

The approach we will take will include us creating a custom flow and an additional check to validate if there was an invitation that was sent in the last 2 days to the recipient related to this Survey, before sending out the invitation.

Creating the Survey Invitation Flow

Choosing Your Trigger

Just like with the Invitations Rules, we first have to specify what will trigger our custom ‘Send Survey’ Flow. In this example we will attempt to send a CSAT survey when a Case status is changed to closed.

For this we will use the Record Triggered Flow type, and set the triggering object to Case. We will also set the Flow to start only when Case is updated.

We also need to set the entry criteria, which ensures surveys are only sent to Cases that are equally closed. This is where we can add additional criteria, such as not sending surveys to critical Cases.

You should also select the following options:

  1. When to Run the Flow > Every time a record is updated and meets the condition requirements
  2. Optimize the Flow for > Actions and Related Record 

Suppressing a Survey

The entry criteria is our first initial method of suppressing survey invitations. But what if we want to take this to a more advanced level? To suppress surveys where the recipient has already received one in the last 2 days, we can check if any Survey Invitation records exist.

Creating Date Resource

The first step is to create a resource to store the date two days before today’s date. You can do this by clicking ‘New Resource’ on the left panel and entering the following information.

Creating ContactId Resource

We also need to do the same for storing the contact/survey participant ID. However this time make sure you select Variable as the resource type and Text as the data type (You could also do the same for a Lead or User).

Getting Previous Survey Invitations

The second step is to get all survey invitations that the current Contact has viewed in the last two days. If no records are returned then it means we can go ahead and send a new survey invitation.

Add a new ‘Get Records’ element onto the canvas and add the following information as shown below:

  1. Object: Survey Invitation
  2. Filter Conditions:
    1. Survey Invitation ContactId = ContactId (the resource we created previously for the Case Contact)
    2. LastViewedDate = TwoDaysAgo (the data resource we created previously)

Tip: Instead of filtering by ‘LastViewedDate’. You could check if they actually completed a survey by filtering using the ‘LastModifiedDate’ and ‘ResponseStatus’ (NOT Equal to Completed) fields.

You also need to add the following configurations to store a Null value when no records are returned. This will be used in the next step.

Checking if a Survey Was Viewed

Finally we actually need to check if any records were returned and what to do for each of these scenarios.

Add a new ‘Decision’ element to the canvas and create the following two ‘Outcomes’.

  1. “Send Survey”:
    1. Record Collection = the record collection you just created in the last step
    2. Operator = Equals
    3. Value = False
  2. “Suppress Survey”:
    1. Record Collection = the record collection you just created in the last step
    2. Operator = Equals
    3. Value = True

Sending a Survey

At this point you can decide how you would like your survey to be distributed if it’s allowed to be sent. A few options are:

  1. Creating an invitation record and sending via Marketing Cloud.
  2. Creating an invitation record and sending to digital channels using the Digital Engagement add-on for Service Cloud.
  3. Send using the Email Survey Flow Action.

For simplicity let’s use the third example. Add a new ‘Flow Action’ element to the screen and search for the survey you want to send (make sure you update the default email settings in the survey builder for the survey you want to send). Then follow the steps in this article using the contactId variable as the ‘Recipient Type’.

What Can I Do After Suppressing a Survey?

If a flow has been suppressed we have a few options:

  1. Do nothing and end the Flow
  2. Update a field on the Contact or Related Record (Case) for reporting purposes
  3. Create a Survey Invitation record to be scheduled at a later date
  4. Check if the last survey was complete and send a reminder if it wasn’t

Finished Flow

Useful links