Send Salesforce Survey using Flow and Process Builder

Send Salesforce Survey Without Code

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.

Salesforce - Enable Survey
Salesforce – Enable Survey

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.

Salesforce Survey Data Model
Salesforce Survey Data Model

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

  1. View / Create Survey
  2. Send (Send Survey to internal or external user)
  3. Analyze (Survey Report)

Below are some screenshots of my demo Survey for this blog post (click to zoom-in image) :

Salesforce Survey Demo Screen 1
Salesforce Survey Demo Screen 1
Salesforce Survey Demo Screen 2
Salesforce Survey Demo Screen 2

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
Salesforce Survey Question Types
Salesforce Survey Question Types

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:

How to send Survey on Case Close in Salesforce
How to send Survey on Case Close in Salesforce

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.

Flow to Send Survey in Salesforce
Flow to Send Survey in Salesforce

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

Salesforce Flow - LookupCase
Salesforce Flow – LookupCase

Component 2 – Contact Record Lookup

Salesforce Flow - Contact Lookup
Salesforce Flow – Contact 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

Salesforce Flow - Community Lookup
Salesforce Flow – Community Lookup

Component 4 – Survey Record Lookup

Salesforce Flow - Survey Lookup
Salesforce Flow – Survey Lookup

Component 5 – Create Survey Invitation Record

Create Survey Invitation Record
Create Survey Invitation Record

Component 5 – Assignment for SurveySubject

Salesforce Flow - Assignment for SurveySubject
Salesforce Flow – Assignment for SurveySubject

Component 6 – Create Survey Subject

Salesforce Flow - Create Survey Subject
Salesforce Flow – 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

Salesforce Email Alert for Survey
Salesforce Email Alert for Survey

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

Launch Flow from Process Builder
Launch Flow from Process Builder

Process builder 2 – Send email alert whenever Survey Invitation created

Send Email alert using Process Builder
Send Email alert using Process Builder

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
Test Salesforce Survey
Test Salesforce Survey

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.

Posted

in

by


Related Posts

Comments

45 responses to “Send Salesforce Survey Without Code”

  1. Sunil Kumar Pal Avatar
    Sunil Kumar Pal

    Thank you Jitendra. I have implemented and its working like a charm. Got some of the issue but fixed them.

    Thank you again.

    1. kapil Avatar
      kapil

      Hello ,

      I can not see Survey invitation and Survey object in org even after enabling survey . Can you help !

      1. Jitendra Avatar

        Check if you have proper permission set assigned to you

    2. Rajesh Barapatre Avatar
      Rajesh Barapatre

      Hey Sunil i need help in flow can you pls help me
      Thanks

  2. Sri Avatar
    Sri

    Thanks Jitendra. But I’m not able to see Survey Invitations under Contacts for Anonymous Responses. Can you please help me with that.

  3. Dimitrios Avatar
    Dimitrios

    Good afternoon from Greece

    First of all I would like to thank you for sharing all this knowledge with us and for expanding our horizons.
    The reason I am contacting you is because I have encountered the following error:

    By reading the Error Occurred During Flow email I can understand that the fault is with the Create Survey Invitation Record element

    RECORD CREATE: Create_Survey_Invitation_Record
    Create one SurveyInvitation record where:
    CommunityId = {!varCommunityId} (0DB1i000000KzG0GAK)
    Email__c = {!varContactEmail} (bithyzis@gmail.com)
    Name = {!formula_surveyName} (Survey for CaseCase-000000058)
    OptionsAllowGuestUserResponse = true
    OptionsCollectAnonymousResponse = true
    SurveyId = {!varSurveyId} (0Kd1i000000L747CAC)
    Result
    Failed to create record.

    From reading the Flow fault email:
    This error occurred when the flow tried to create records: INACTIVE_OWNER_OR_USER: operation performed with inactive user [0051i000001VGaX]. You can look up ExceptionCode values in the SOAP API Developer Guide.

    the error is caused by Inactive_owner_or_user which currently blew my mind.

    Any assistance will be greatly appreciated.

    With regards
    Dimitrios

  4. Joe Avatar
    Joe

    At the end of Step 1, you mention:

    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.

    I was wondering where to create that field for Survey Invitation? I don’t see that object in Setup in my org.

  5. Joe Avatar
    Joe

    Hi at the end of Step 1, you mention that we have to create an email field on Survey Invitation object, but I’m seeing the survey invitation object in my org. Can you please elaborate where to create that field?

  6. DJS Avatar
    DJS

    Hi Jitendra,

    Works perfectly for me. Trying to implement it now for multi-language community, so if a field on the contact = FR, it should send the french translation of the survey. Any tips or tricks on where to implement this part? Been trying different options but it doesn’t seem to work.

    Thank you!

  7. Harika Avatar
    Harika

    Hi how to query Network object to get Community Id in Salesforce

    1. Adwait Gogate Avatar
      Adwait Gogate

      Go to Setup -> All Communities -> Hover over the Active Community link which you are using for Survey. On the bottom above Task Bar of your computer you will see URL which will have “networkId=xxxxxxxxxxxxx” The 15 digits after networkId= is your Community ID

  8. Yazmin Gonzalez Avatar
    Yazmin Gonzalez

    Hello,

    I’m can’t see Survey on app menu so i am trying to add Manage Survey to permission set to a system administrator but it gives me an error that says the user license doesn’t allow the permission.

    What should i do?

  9. PK Avatar
    PK

    Can we send to contacts who are not community users and still track them with survey invitations?
    On survey invitation I am only seeing the invitation link for community users. How can we automate to send surveys to case contacts who are not community users and track their responses and roll up to the case (anonymously)
    Also, I am not able to view survey subject to add as related list to case or opportunity, any idea?

    1. Adwait Gogate Avatar
      Adwait Gogate

      Hi Jitendra

      First of all a great post. Very well explained. But It can be done using only Process Builder also. Here’s the Help Article which I referred to and found useful. https://help.salesforce.com/articleView?id=task_generate_invitation_using_process_builder.htm&type=5 It links Survey Invitation and Survey Response with that respective Contact record.

    2. Minyi Avatar
      Minyi

      Hi PK, did you find a solution for sending survey to contacts outside community? Could you please share with me ? Thank you!

    3. Minyi Avatar
      Minyi

      Hi PK, did you find a solution for sending survey to non-community users? (contact) It will really be appreciated if you can share the solution ! Thank you!

  10. Shweta Avatar
    Shweta

    Thanks for such a informative writeup, cant we combine both the process builder just wondering?

  11. Poonam Avatar

    HI Jitendra,
    Just wanted to check if salesforce surveys are lightning compatible?

  12. Minyi Avatar
    Minyi

    Hi Jitendra, thank you so much for your post. It works well!

    I just wonder if we can create multiple unique survey invitations to multiple contact in one flow? Right now I use one flow to create one survey invitation for one contact and I need to create 10!

    Thanks!

  13. SARTHAK GARG Avatar
    SARTHAK GARG

    Want to send a survey link for the guest user in salesforce once case is closed.Please suggest any app?Used Survey-Force ,but its requiring guest user login and password,but this should not happen.Guest user should be redirected to vf page.

    This can be done by:——> develop a vf page of survey information ,which is sent to customer email id when a corresponding case is closed .Also want to store the survey submitted by customer(guest user).

    Please provide the code of vf page for this requirement.

    1. Gokul Avatar
      Gokul

      Hi SARTHAK GARG,

      Have you found the solution for this? if possible can you please help me on this..

  14. ZerovizBoss Avatar

    Jitendra,

    Hi and thank you.

    There appears to be a known issue that has yet to be resolved regarding the emailed link for a Survey to a guest user. I just wanted to know if you’ve run into this issue or would be willing to discuss further.

    Environment:
    I’m able to send the link (embedded link) via email on a Closed Case to an external client Contact. However, when the button link is selected I get a 404 error code that indicates it’s looking for \aura component. I’ve searched my org and can find no such component even exists outside of the system generated (public folder) Customer Satisfaction survey.

    We also have an installed package called Survey and I’m wondering if there could be something in the managed package overriding our ability to create our own Surveys.

    Suggestions/guidance greatly apprecaited

    Zerovizboss

    1. ZerovizBoss Avatar

      Never mind, I solved my own issue and it was a rookie mistake.

      1. Gokul Avatar
        Gokul

        Hi ZerovizBoss,

        Have you found the solution for guest users taking the survey without login? Can you please help me on this..

  15. pramit Avatar
    pramit

    Hi Jitendra – We are planning to load around 300+ surveys from another system to salesforce. Is there a way to data load these in to Survey object? I am not able to find a way to insert/upsert on this Survey object except query.

    Thanks!
    Pramit

  16. Don Avatar
    Don

    Jitendra,

    Okay, I’m having a new issue…I’ve followed your logic but I’m not able to see the sObject Variable for sObjSurveySubject. I’ve tried creating a Collection Variable, and making an assignment, but that’s not working either. Any suggestions?

    Don

  17. Shradha Bhat Avatar
    Shradha Bhat

    Hi,
    I have a requirement wherein we have to create cases based on the survey response we get. Is this possible?

  18. sanjyothi Avatar
    sanjyothi

    Hi,

    I have followed all the steps above, i need to have case number on email template so i used custom field and incorporated it on my email template. however i have been getting error below inspite my survey is active i als tried to create a new survey an incorporate it but still it is not working please help

    Error Occurred: This error occurred when the flow tried to create records: INVALID_FIELD_FOR_INSERT_UPDATE: Your survey hasn’t been activated yet. Activate your survey and try again.. You can look up ExceptionCode values in the SOAP API Developer Guide.

    1. Santhosh Kumar Avatar
      Santhosh Kumar

      Hi Sanjyothi,

      Even Iam facing the same issue. Did you find the fix for this issue?

  19. Eduardo Gabriel Colli Avatar
    Eduardo Gabriel Colli

    Hi!
    I’m facing some issues. I configured everything like you showed, but I have problems using salesforce classic email template.
    I added {!SurveyInvitation.Host_Name__c} but always show it as null when email is sent. I cheked in Survey Invitation page layout and it has a value but it appears empty in the email.
    Anyone has experienced anything like this?

  20. Brijesh Avatar

    Ardira releases Free Surveys and Forms application SurveyVista : 100% Native Salesforce Surveys, Forms, Quizzes, Checklists, & Assessments.

    See us on AppExchange at https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FYkISUA1

    Your feedback, ideas, comments are welcomed in Collaboration Group – SurveyVista Surveys, Forms, & Checklists – https://success.salesforce.com/0F94V000000Tz8u

  21. Edgar Dalupan Avatar
    Edgar Dalupan

    Hi Jitendra,

    Thanks for this very helpful guide. I am curious to know though, would this work if I’m sending the survey to a non-community contact? Thanks!

    1. Prentiss Avatar
      Prentiss

      You Need to Set Up Guest User in the Community

  22. Manila Avatar
    Manila

    Hi Sir,

    I have a quick question regarding sending the surveys. Is it possible to send the surveys to a group of contacts through process builder.

    Any help would be muc appreciated.

    Thanks,
    Manila

  23. Raj Avatar
    Raj

    Hi, we are able to capture the responses in survey responses. but how to populate in Case object the survey response values like csat, nps… is there any code required for this.

    now in case related list having survey subject which contains all other information.

    1. Joni Bondo Avatar
      Joni Bondo

      Hi Raj

      I have the same doubt.
      How do we populate Survey results (aka responses) in the case objects.
      Our Agents needs to be able visualize the feedback we get for each case.

  24. Todd Kadas Avatar
    Todd Kadas

    Hello-I tried to create an outbound change set to migrate survey from sandbox to prod. I was able to locate the add the survey using flow definition. In prod, however, when validating inbound change set, I received following error: pageNamesInOrder (Variable) – A Survey required variable must be defined as both input and output. Any idea how to resolve? It doesn’t seem that I am able to access the survey flow to define variables. Thanks

  25. Graham Webster-Newman Avatar
    Graham Webster-Newman

    This is a really useful post, thanks! Do you know of a way to use flow/process builder to get the questions and answers someone has selected using a generic link and get them into an email when a response is received?

  26. M Best Avatar
    M Best

    This was extremely helpful. Thanks!

    1. Nikita Avatar
      Nikita

      Hi, I tried creating this flow and when I test it… It shows below error when I open my survey link.
      Link was working before creating flow.

      This page has an error. You might just need to refresh it.
      Error in $A.getCallback() [Event fired]
      Callback failed: serviceComponent://ui.interaction.runtime.components.controllers.FlowRuntimeController/ACTION$runInterview
      Failing descriptor: {markup://flowruntime:flowRuntimeV1}

  27. Nikita Avatar
    Nikita

    Hi I tried this way… but when i try to open survey link I’m getting this error message

    This page has an error. You might just need to refresh it.
    Error in $A.getCallback() [Event fired]
    Callback failed: serviceComponent://ui.interaction.runtime.components.controllers.FlowRuntimeController/ACTION$runInterview
    Failing descriptor: {markup://flowruntime:flowRuntimeV1}

    Any idea why showing like this? Because link was working before creating this flow.

  28. Nikita Avatar
    Nikita

    Hi, I tried creating this flow and when I test it… It shows below error when I open my survey link.
    Link was working before creating flow.

    This page has an error. You might just need to refresh it.
    Error in $A.getCallback() [Event fired]
    Callback failed: serviceComponent://ui.interaction.runtime.components.controllers.FlowRuntimeController/ACTION$runInterview
    Failing descriptor: {markup://flowruntime:flowRuntimeV1}

  29. Chris Chitemerere Avatar
    Chris Chitemerere

    Thank very much for the article. Are these instructions still applicable in the current version of Salesforce?
    Regards,
    Chris

  30. Vamss Avatar
    Vamss

    The person who created the survey is made inactive in the org and now due to it end users are not able to submit their responses..so is there any way i can make the survey available for end users.?

  31. Rebecca Avatar

    Thank you for this wonderful step-by-step!

    Is there a way to see the response per case?

    example case X123, on status closed sent a survey.

    I see where I can view ALL the anonymous responses, but is there a way to track a response to a specific case?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading