Send survey on case closure and relate the response to case and contact

  • September 27, 2021

Prerequisites: Survey and Community should be enabled for the organization.

Enable Surveys – https://help.salesforce.com/s/articleView?id=sf.task_enable_surveys.htm&type=5

Enable Community – https://help.salesforce.com/s/articleView?id=sf.networks_enable.htm&type=5

Create all custom fields required for automation.

Create URL field on Case object for -” Survey Link.”

Create a Lookup to Case on Survey Invitation Objects.

2. Create an email template and make it available for use. Edit the text to suit your needs.

Sample Email body-

Dear {!Contact.FirstName},

Thank you for submitting case number {!Case.CaseNumber}, now that the issue is closed, please consider completing this survey.

{!Case.Survey_Link__c}

Thank you,

3. Create an Email Alert. Object: Select Case Email Template: Select the email template you created above. For Selected Recipients: Move “Related Contact: Contact Name” to the right. Save.

4. Create a new Process Builder (Setup/Process Builder/New) to automate sending the survey upon Case closed.

Choose Case as the object and select “when a record is created or edited.”

b. Define Criteria: Give it a name/ Select “Conditions are met.” In Set Conditions, you need:

[Case].Status/Equals/Picklist/Closed.

[Case].ContactID/ISnull/Boolean/False

Conditions select “All of the conditions are met (AND).”

Do you want to execute the actions only when specified changes are made to the Record? = True

5. Next, for Immediate Actions, we need to Create a Survey Invitation Record. You will need the following Set Field Values shown in the picture below.

To get the survey ID open the survey record in salesforce and copy the 18 digit ID from the URL.

Network ID: Get Network ID by going to Digital Experience/All Sites and right-click on the Community URL you selected when you enabled surveys, “Copy Link Address,” and then paste this link in a document and grab the ID. Then grab the ID highlighted and leave off the & at the end.

https://ap15.salesforce.com/servlet/networks/switch?networkId=0DB2v0000004Ifd&

6.. Next, in the Immediate Actions, add Email Alerts, type the name of the Email Alert you created above.

7. You can now Save and Activate this Process.

8. Now, we need to create a second Process Builder.

  1. For your Object, choose Survey Invitation. Start: only when a record is created
  2. For Criteria, choose “No criteria-just execute the actions!”

It will look like this: [SurveyInvitation] Case. c. Immediate Actions — choose Update Records, and for the Record, choose Case. Select “No criteria-just update the records!” For setting the values, in Field: select Survey URL, Type: Formula. Now the Value, click on the Value box so that it expands to allow you to create your formula.

9. Getting the “Value,” go back into your latest survey version and click Send so you will see the Get Survey Link window.

Click “Don’t require authentication” and Copy Link.

Now paste that URL in a document we will have to replace the hardcoded Ids in the link with [SurveyInvitation].Id & [SurveyInvitation].UUID

https://rdubey-developer-edition.ap15.force.com/survey/runtimeApp.app?invitationId=0Ki2v000000QBdf&surveyName=flashhhhh&UUID=337aa6b6-6eb1-42ac-8803-66a8d9fa4767

b. Change the link to the below format. Make sure you have included the open and close ”

“https://rdubey-developer-edition.ap15.force.com/survey/runtimeApp.app?invitationId=” + [SurveyInvitation].Id + “&surveyName=flashhhhh&UUID=”+[SurveyInvitation].UUID

10. Paste this new formula URL you have created into the box and click “Use this formula.”

11. Save and Activate this Process.

12. Make sure your Guest User in the Community has CRUD permissions.

  1. Enter Digital Experience in the Quick Find box, then select All Sites.
  2. Open the Community Builder, which is selected as the default community for creating public survey invitations.
  3. From Community Builder, click the Settings icon and select General.
  4. Click the profile name under Guest User Profile.
  5. Click Edit.
  6. Standard Object Permissions section, add the following permissions:

    Object: Survey
    Permission: Read
    Object: Survey Invitations
    Permission: Read
    Object: Survey Responses
    Permission: Read, Create, AND Edit

  7. Save

— By Rishabh Dubey