Using Screen Flow to Create a Public Survey

Using Screen Flow to Create a Public Survey

Customer service is the support that you provide to your customers. It is crucial to offer a great customer service in order to grow your business and retain customers. Customer support is more than just providing answers to your customers. According to a Gartner research, 89% of companies now expect to compete mostly on the basis of customer experience. Since great customer support drives an amazing customer experience, it is important for companies to focus on their customer service support. There are a few ways to know if customers are satisfied with the customer service. Survey is the most common method of gathering information.

Case Object and Surveys in Salesforce

Case is the main object of Salesforce Service Cloud. You can use the case object to manage cases for your organization. There are many ways to create a case record in Salesforce. A case record can be created from a phone call, email, chat, or a web form. It typically represents a customer's request or problem. Therefore, if you want to measure customers' satisfaction from the customer support, you should consider sending surveys when case records are closed.

There is a standard feature for sending surveys. On the other hand, there are many third party solutions to send surveys. However, in some situations, these may not be preferred by the companies.

It is possible to build a screen flow with some questions and use it as a customer satisfaction survey. Salesforce users can use flows, but how can you make a flow public so that your customers can use it as well? You can put your flow to a public Experience site and send a link to your customers. However, don't forget to pass parameters from the URL and make the flow dynamic. Read this post to learn more details about passing parameters to flows in Experience sites.

Let's see how to build a simple screen flow to be used as a customer satisfaction survey.

Building a Screen Flow

Let's create a customer satisfaction survey with 3 questions and one free text for the customer's feedback. In this example, let's assume that we are sending a survey link to the customer when a case is closed. Then we will save the survey answers to a custom object called Survey_Answer__c. This is not mandatory and you can save your answers to the related case record as well.

This screen flow will be in a public Experience site and we will pass parameters from the URL. Since we expose the parameters, it is important to pass multiple parameters and build the flow accordingly. This will decrease the chance for the users to modify the values and access other data. Therefore, let's pass both the case Id and case number, so that it will be impossible to guess them correctly at the same time.

1- First of all, create two input text variables for the case Id and the case number. Let's call them Id and Key. The flow should find the case record according to these variables. However, if the Id is not in the correct format (customer can manually change it from the URL), then the flow might fail. Because of this, it is important to check if the format is correct.

Create a number formula that shows the length of the Id.

Formula for the length of the Id

Then, add a decision to check if the length is 18 and starts with 500 (all the case record Ids start with 500).

Decision to check the Id format

2- If the Id is not in the correct format, go to a screen that displays a message like this.

Sorry, we couldn't find this case in the system.

3- If the Id is in the correct format, add a Get Records element to find the correct case record according to the Id and the Case Number.

Get the correct case record

4- Add a decision to check if the case record exists. If not, go to the same screen that you created in the second step. If the case record exists, get the related Survey_Answer__c record to see if the customer filled the survey before.

Decision element to check if the case is found.

5- Add a Get Records element to get the Survey_Answer__c record that is related to the case (let's assume that this object has lookup fields to case, account, and contact).

Get the survey answer record

6- Add a screen element for the survey. This is the main screen of this flow and it should contain the survey itself.

In order to make the experience more personalized, add a display text for the introduction. Contact_Name__c is a formula field that displays the full name of the contact, but you can also use the standard fields (FirstName and LastName) from the contact.

Introduction text of the survey

7- For the questions, add radio button components and create choices that display stars but store numbers. For example, this choice displays 3 stars (emojis) but stores 3 as a number.

Star choices for the survey answers

Add your questions as radio buttons and create 5 choices for the star ratings. At the end, add a long text field for the customer's feedback.

This screen will look like a survey.

Customer satisfaction survey with radio buttons

8- When you build a flow, you usually build it for your users. However, this flow is for your customers and the user experience is critical. Since there is no standard input component for star rating, we created choices that display stars. It looks okay, but it doesn't look like the surveys that we are familiar with.

Therefore, let's use this custom screen component that allows the users select star ratings. Install the component from this link, add display text for the questions and add the StarRatingComponent for the answers (for each question).

StarRatingComponent for the answers.

As you can see, you can set the maximum number of stars, make the component read only, and set a default value. At the end, it stores the number of the stars that the user selects.

In this example, let's allow customers change their answers. Therefore, let's not make the component read only and set the existing survey answer as the default value.

Survey answers with the StarRatingComponent

9- Add a decision element to check if the survey answer exists (from the 5th step).

Decision element to check the survey answer

10- If it exists, update the existing survey answer.

Update survey answer

If it doesn't exist, create a new survey answer record. Don't forget to map the lookup fields too.

Create a new survey answer record

11- Display a success message. (And confetti, because why not?)

Success message at the end of the flow

From the advanced properties of the flow, make it run in the system context without sharing. So that it will work fine for the guest users.

At the end, your flow should look like this.

The end of the flow

Adding the Flow to a Public Experience Site

Using Salesforce Experience Cloud, you can create branded digital experiences to share information and collaborate with people. With its drag and drop builder, you can easily build Experience sites.

1- Enable Digital Experiences in setup and create a new site. In this example, I selected Customer Service as the template.

2- In the builder, make it a public site by marking "Guest users can see and interact with the site without logging in".

Make the site public

3- Remove all the pages and create a new page called CS Survey (URL is cs-survey). Then, add the flow to the content area. For the input variables, enter {!Id} and {!Key}. Read this post to learn more about passing values to a flow in an Experience site.

Add the survey flow to a Experience page

Optionally, add more components to make the page beautiful. For example, I added Salesforce Time logo.

4- Publish the site and then activate it.

Giving Permission to Guest User Profile

The flow and the site are ready. However, guest users cannot even see the flow, because they don't have the permission. Salesforce removed the "Run Flow" permission from the Guest User profile. However, don't worry, there is a way to give permission.

Go to flows in setup, find your screen flow, click the small arrow on the right side. Then, click "Edit Access". Mark "Override default behavior and restrict access to enabled profiles or permission sets." and then select the profiles that can use this flow. You won't be able to see the guest user profile here.

Configure user access to run the flow

Go to the builder of the Experience site, click the settings and click on the name of the guest user profile. In this example, it is called "Survey Profile".

Experience Settings

Scroll down to the Enabled Flow Access and add your flow to the list. This action will give permission for running the selected flow.

Give permission to the guest user profile.

Summary

Using a screen flow and a public Experience site, you can easily create surveys for your customers. In this example, we save the survey answers to a custom object. Since the survey is related to a case, you can save them to the case record as well. However, if you want to send surveys without case records, then it is a better practice to use this custom object.

Here is a link for the public survey that we built. Since it is public, anyone can run it. Go ahead and play with it!

Let's see the flow in action!

Here is the survey answer record that the flow created. Since all the answers and customer details are saved in the record, it is easy to build reports and calculate the customer satisfaction rate.

Survey answer record in Salesforce

15 Comments

  1. This is a great post, thank you! One question: how did you make it so that the "thank you" page does not show the "previous" or the "finish" button? If I try to disable both on the screen component, I get a message telling me that I can disable one or the other, but not both.

  2. Have you thought about making it so you could change the icon that is used? This would be beneficial for other use cases that a star may not be appropriate (i.e. creating a survey item where we aren't rating satisfaction, but maybe health score or safety score)

  3. When trying to run from survey site as guest is fails, and the following flow error occurs on mail:
    Error element Get_Case (FlowRecordLookup).
    This error occurred when the flow tried to look up records: AccountId, OwnerId, ContactId FROM Case WHERE (((Id = 'xxxxxxxxxxx') ^ ERROR at Row:1:Column:68 sObject type 'Case' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names..

    I guess the guest profile is missing permissions to read/write on the sObjects?

    This was not described in your guide? Or am I wrong 🙂 thanks.

  4. Hello, I've recently installed your component and i have a problem...
    Basically i have a checbox on the screen and if the user checks the checkbox(value=true) your component should disappear (and this part is working ok) but if he then unchecks the checkbox(value=false) the component doesn't appear and to make it appear again i have to change screens or reload the page, can you help with this?

    Note:
    I have checkbox=false as the criteria for the component to show

  5. Hello, thanks for sharing this article. I published my site from a sandbox and have been trying to test the link in incognito mode and the page opens up but the flow does not show. I followed your instructions and went to the guest profile from experience builder but Flow Access is showing nothing to select. My flow is active and is under the run as system context setting.

    Any idea why no flows are showing up under the Flow Access page in the guest profile?

    • Nevermind....I never hit save on the step for going into the "edit access" part in the flow for system admin...which then allowed it to show under guest user profile flow access

  6. Hi! This is exactly what I've been looking for! I've have built out my flow in my sandbox environment, added it to the experience site, and when I go to test the link in an incognito window, I get the "Sorry, we couldn't find this cae in the system" message from the case not found screen. Good news is my flow appears to be working. However, since the first element in the flow is a decision to check if the case is in the correct format, how does the case ID get passed into the decision element to kick it off from experience site? I'm sure it's something simple I just overlooked. Your help would be greatly appreciated. Thanks!

4 Trackbacks / Pingbacks

  1. Star Rating Component for Flow Screens - Salesforce Time
  2. From Yumi: Add a Star Rating Component to your screens – UnofficialSF
  3. How to Hash Any String Using Salesforce Flow - Salesforce Time
  4. How to Allow Guest Users to Access Flows - Salesforce Time

Leave a Reply

Your email address will not be published.


*