Salesforce Survey is available in Health Cloud & Financial Service Cloud otherwise its paid. Community Cloud is also required to use Survey. If you need to practice Survey, create a 30 day trial org from this URL (mentioned in this trailhead module). One Survey can be created and used in Enterprise and Unlimited edition, so if you need only one survey then its free. In my case, I had to send same question to every customer on Case close , so it was free.
Prerequisite to use Salesforce Survey
Step 1 – Enable & create Community. Once community setup is done, we would need to activate it. Community can be created by any template. It can be blank as well, if it’s being created only for survey.
Step 2 – Enable Salesforce survey by navigating to Admin setup. You would need to select Community, which would be used by Survey to compute public unique link.
Step 3 – Create and assign permission set, giving access to Manage Survey and CRED permission on Survey objects. This step is needed only if you are not able to see Survey in App menu.
Before moving ahead, we need to understand Survey Data Model. I’ve created below data model for this blog post to explain various objects involved.
Survey would be created by Admin. If we want this survey to be used by any customer, then need to create Survey Invitation and send link to customer. There are many ways to send survey but I would explain the technique that worked for me.
Step 1 – Create Survey
Navigate to App menu and search for Survey. Creating a new Survey in Salesforce is smoother than driving Tesla Model 3, just follow screen instructions.
Every Survey would have below three options for Admin
- View / Create Survey
- Send (Send Survey to internal or external user)
- Analyze (Survey Report)
Below are some screenshots of my demo Survey for this blog post (click to zoom-in image) :
Survey must need to have minimum 3 pages – Welcome Page, questions page & Thank you Page. Each page, at the time of writing this article contains below question types :
- Date
- Multiple Choice
- Picklist
- Radio
- Rating
Once Survey setup is completed, we would need to activate it. Now let’s talk about what are the different pieces we would need and how they all can be glued together.
Below image tries to simplify, what we would be doing in rest of the blog post:
Before moving on next step, we would need to create a custom field of type Email on Survey Invitation object. This field would be used to store contact’s email address and send email alert.
Step 2 – Create Flow
Below image shows, how the final flow would look like. If you have worked on flow, you might be able to pick it up without even going through rest of post.
We would need to create below variables in flow
- CaseId (Text, Input and Output)
- caseNumber (Text, private)
- communityId (Text, private)
- contactEmail (Text, private)
- contactId (Text, private)
- surveyId (Text, private)
- surveyInvitationId (Text, private)
sObject Variable
- sObjSurveySubject (private, object type – SurveySubject)
Formula Variable
- formula_surveyName (Text, formula – ‘Survey for Case ‘+{!caseNumber})
Let’s start with creating component on Flow Canvas
Component 1 – Case Record Lookup
Component 2 – Contact Record Lookup
Component 3 – Community Record Lookup
We would need Id of Community, so instead of hardcoding, we are going to query Network object to get needed Community Id
Component 4 – Survey Record Lookup
Component 5 – Create Survey Invitation Record
Component 5 – Assignment for SurveySubject
Component 6 – Create Survey Subject
Step 3 – Create Email Template and Email Alert
For sake of simplicity, we would create HTML email template without letterhead. Email Template would be created for object Survey Invitation, other than Email__c field, I have also created Host_Name__c field of type formula (Text). We would need this field to compute survey link.
Host_Name__c =LEFT($Api.Partner_Server_URL_430, FIND( '/services', $Api.Partner_Server_URL_430))
Below is the content of Email template we would be using
How was your interaction with service agent. Please take 2 mins to answer few questions in survey. <a href="{!SurveyInvitation.Host_Name__c}survey/runtimeApp.app?invitationId={!SurveyInvitation.Id}&surveyName=survey_demo&UUID={!SurveyInvitation.UUID}"> Click here to begin survey </a> ~Cheers, Jitendra Zaa
You might already have figure out the format of Survey Invitation Link from above email template, which looks like below
https://jit30trial.force.com/survey/runtimeApp.app?invitationId=0Kib4000000DKMG&surveyName=survey_demo&UUID=982900a2-ce21-4c44-95fa-4763b3bfe24e
It’s time to create email alert using above email template
Step 4 – Create Process builder
We would need two process builder to complete this setup :
Process builder 1 – Create Survey Invitation using Flow created in step 2. We would need to pass case Id to flow as shown in below image
Process builder 2 – Send email alert whenever Survey Invitation created
How to Test
- Create a case with contact having valid email address
- Mark Case status closed – it should trigger Process builder to invoke Flow
- Contact’s email address should receive an email, clicking on link should take user to survey page
Note : At time of writing this blog post, I came across this known issue, if you are impacted, let Salesforce know by clicking on This Issue affects me button.
Leave a Reply