Prerequisites
- Make sure to enable communities and create one community this required to enable survey.
2. As soon as a new community is created make sure to activate it3. Enable survey from Admin setup. Follow below path to enable survey from classic. But the object related to Survey will not be available in Classic , you should goto lightning to access Survey objects.
Setup --> Build --> Customize --> Survey4. To enable survey we need to select community , please select the community which you have created in previous steps.
5. By default survey tab is hidden for system admin, go to profile and enable the tab and also give required CRUD permissions.6. Also please make sure to provide required access to community Guest profile for below object access.
7. If you want to send anonymous survey to the users outside of your company , please make sure to enable ‘Lightning Features for Guest Users ’ otherwise they will get Page not found 404 error when users opens the link. Follow below path to enable this.SetUp --> Build --> Communities --> All Communities --> Click ‘WorkSpace’ of desired community --> It will launch Workspace of your community --> Select Administration Tile --> Open ‘Pages’ --> Click ‘Go to Force.com ‘ --> Will redirect to Site Details Page --> Edit the site details and Enable ‘Lightning Features for Guest Users ’ feature.
8. Before moving next step I will explain you the data model of survey9. Survey is Parent for All below Survey related Objects
10. Survey Subject is child for --> Case , Live Chat Transcript & etc
11. Survey Invitation is child for Contact / User.
System Admin have capability to create survey. If you want to create a survey link and want to send to customers. There are couple of ways where it send to customers.1. You can generate Survey link manually and send to the customers2. Through process builder and code you can send survey link to customers without manual efforts3. Through process builder and flows, just point and clicks no need of writing code.This blog explains how to send survey with code and process builder.First will explain you with Process builder and Code.
Create Survey:
Navigate to Survey Tab and click new to create new survey.
Every Survey would have below three options for
Admin
1. View (Where you can create survey)
2. Send (Send survey to internal and external (No need of authentication /
Anonymous Survey link) user)
3. Analyze (Survey Report where you can check)
Sample Survey creation dialogs how it looks.
1.
Date
2.
Multiple Choice
3.
Net Promoter Score
4.
Picklist
5.
Rating
6.
Ranking
7.
Score
8.
Slider
9.
Text
- Now your survey is ready to use . Make sure to activate this survey.
- No I will explain you how to send survey to external users on case close / chat is ended. Here I am taking after case close how the survey will trigger.
1. First we need to create two custom fields on Survey Invitation to store Email and Host
2. Email__c (Contact /User Email)3. Host__c (Host will different for authenticated and unauthenticated surveys. Here I am hard coding my host : https://mallareddymadhu-developer-edition.ap5.force.com/Trailsupport)
Create Email Template and Email Alert:
We would create HTML email template
with / without letterhead. Email Template would be created for
object Survey Invitation
Sample link looks like this: https://mallareddymadhu-developer-edition.ap5.force.com/Trailsupport/survey/runtimeApp.app?invitationId=0Ki7F0000004***&surveyName=Case_Survey_Report&UUID=f1cc3f24-50be-44f0-a9cd-4217cddf6221
Create Workflow Email Alert:
- Create Workflow rule on Survey Invitation Object , when a new Invitation is created
- Receiver is Email Field , which we created on Survey Invitation
Create Process Builder:
1. Create Process builder on case object, Criteria you should use is where Case Status = Closed.
Below is my Apex Class where this process builder is used to invoke to create Survey Invitation.
How to Test :
- Create a case and contact should have valid email
- Close the case, this will trigger process builder and will create survey invitation. As soon as Survey invitation is generated Workflow will trigger and send email alert to case contact.
- Check your email address, contact of the case will receive email.
Thanks for
Blogging. In my next Post I will explain how to send survey with Point and
Clicks (Process Builder and Flow)
9 Comments
with the same code, invitation link is not being populated
ReplyDeletewith the same above code, invitationlink field has no value in it
ReplyDeleteI am not updating survey invitation link field. I am generating the link from my template directly.
ReplyDeleteHere is the template how I am generating survey link
Start survey
Regards,
Admin
I am generating link within email template.
ReplyDeletehi sir
DeleteI am trying to send the survey intivation to external customer
DeleteThis comment has been removed by a blog administrator.
DeleteThat you can achieve based on the information that you have for the external user.
ReplyDeleteWith this code, my user can subjt multiple responses to the survey. How can i restrict that
ReplyDelete