Friday, 2 September 2022

Salesforce Survey: Get Started


Salesforce Survey is a feature provided by Salesforce to gather data from customers/users and store that information in Salesforce. This feedback can be utilized by companies to make business decisions.

Enable Salesforce Surveys

  1. In order to generate links for Salesforce Survey, we need one community that will be used. You can create one in Setup -> Digital Experiences

  2. Salesforce Survey can be enabled by Navigating to Setup -> Survey Settings -> Surveys (Enable it)

Creating Survey with Survey Builder

1. A Survey record can be created from App Launcher, by searching for
“Surveys” -> New

2. It will open Survey Builder, which is a UI-based tool to design and customize the survey form. Various types of questions can be created within the builder.

3. Survey Builder also provides a way to add conditional questions into the Survey based on responses to other questions

4. After designing the Survey, it needs to be activated before sending.

5. Like Flows, Salesforce survey creates a survey version that can be sent to the customers. For making any changes, a new version needs to be made.

Translating the Salesforce Survey

Salesforce Surveys can be translated to other languages which allows recipients to select their preferred language.

This can be done by going to the “Languages” related list on the Survey Record. If the Translation Workbench is not enabled in your organization, you might face this error.

To provide translation of the survey we created earlier, we need the Translation Workbench to be enabled first. This can be done by going to Setup -> Translation Workbench -> Translate

After enabling the Translation Workbench, we need to add Translator(s) who can translate the survey. Click on Add to add the translator.

Now as we have added our current user as Translator for English and German language, we can see two translation options in the “Languages” related list.

Click on Translate to provide the translated version of the content.

Sending the Salesforce Survey

There are multiple ways to send the Survey out for customers to fill. Below are some of the ways which can be used as per the business requirement.

1. Survey Invitation Rules

You can create criteria-based rules on objects to trigger the invite whenever the criteria are met.

Setup -> Surveys -> Survey Invitation Rules

Click “New Rule” to open configure screen

Configure your record event, Object, and criteria for sending the survey.

Save and Activate the rule.

Note: If your survey is not coming in the dropdown in above screen the, first specify Email Template here, then try to create the Invitation rule again.

2. Flow:

Salesforce provides standard action in Flow to trigger a survey invitation.

Survey Invitation details like survey recipient can be configured in the action.

Flow overview:

3. Apex Code

In case, we want to send a survey from Apex code, then we have to insert multiple records and also handle the outgoing survey invite email from our end.

  1. Insert Survey Invitation record.

Id communityId = [SELECT Id FROM Network WHERE Name = ‘Survey’].Id;

Id surveyId= [SELECT Id FROM Survey WHERE Name = ‘CSAT Survey’].Id;

Case caseRec = [SELECT Id, ContactId, CaseNumber FROM Case WHERE CaseNumber = ‘00001015’];

SurveyInvitation invite = new SurveyInvitation();

invite.CommunityId = communityId;

invite.SurveyId = surveyId;

invite.ParticipantId = caseRec.ContactId;

invite.Name = ‘SurveyInvite’;

invite.OptionsCollectAnonymousResponse = false;

invite.OptionsAllowGuestUserResponse = true;

Insert invite;

2. To link the invite send with the related record, in this example, the case record

SurveySubject subject = new SurveySubject();

subject.SubjectId = caseRec.Id;

subject.Name = caseRec.CaseNumber;

subject.ParentId = invite.Id;

Insert subject;

3. Sending the email with the link to fill the survey

SurveyInvitation object has a field, ‘InvitationLink’, You can create an email template with this merge field on SurveyInvitation and send it through Email Alert or Apex SingleEmailMessage.

Salesforce Surveys Object Model:

No comments:

Post a Comment