How to Pass Parameters to Flows in Experience Sites

How to Pass Parameters to Flows in Experience Sites

Lightning pages are one of the most common ways to launch Screen Flows. It is possible to add an active Screen Flow to a Lightning page and pass parameters to input variables from the flow. In this case, every time the page loads, the flow runs and its first screen is displayed. This is a great way for the users to run a flow. However, since it is a Lightning page, it is available for the internal users only. What about the external users that are using Experience Cloud sites?

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. Just like in Lightning pages, it is possible to add active Screen Flows to pages of Experience sites. This way, you can let the external users run flows. Moreover, you can add a flow to a public page, which makes the flow public. This means that anybody that is viewing the page will be able to run the flow (you have to give permission to the Guest User profile).

Just like in Lightning record pages, if you add the flow to a record page, you can pass the record Id into an input variable. However, if it is not a record page, there is no option to pass a record Id. You can still pass some values but you have to hardcode them, which is not useful in many cases.

Flow on experience site

How to Pass Parameters from the URL

There are 2 ways to pass parameters to flows from URL. In both of these ways, relevant flow variables must be marked as available for input.

1- Pass values using parameter names and values

Just like passing values from a custom button, you can pass the values in this format:
https://OrgLocation.com/CommunityName/s/PageName?ParameterName1=Value1&ParameterName2=Value2

This is how you can send the parameters. However, it is not enough, flow should catch them as well.

In order to catch the values from the URL, you have to click on the flow component and manually enter the parameter names into the flow variables in this format:
{!ParameterName1}

For example, let’s assume that you want to pass 2 different parameters from the URL and names of those parameters are Id and Key. Here is how the URL should look like:
https://youme-dev-ed.my.site.com/survey/s/cs-survey?Id=5001n00001kdC7uAAE&Key=00001133

Since the parameters are called Id and Key, you have to enter {!Id} and {!Key} to the input variables.

Catching parameters from the URL

In this example, parameter names and variable names are the same. However, it is not mandatory to give the same name. For example, if the parameter name is recordId and you want to pass it to a variable called CaseId, then you have to write {!recordId} to the CaseId variable.

Flow on public experience page

As you can see from the screenshot, flow got the parameters from the URL and found the correct Case record.

2- Pass parameters using flow arguments in the query string

The second way to pass parameters is using flow arguments in the query string. In this option, there is no need to catch the values. Moreover, it runs the flow itself without navigating to a page from the Experience site. This format gives you more control over your variable inputs while you’re on the Flow page.

Here is the format:

https://OrgLocation.com/CommunityName/s/flow/flowName?flowArguments=[{“label”:”variable1Name”,”dataType”:”String”,”value”:”value1″},{“label”:”variable2Name”,”dataType”:”String”,”value”:”value2″}]

Here is the previous example with this format:

https://youme-dev-ed.my.site.com/survey/s/flow/Customer_Satisfaction_Survey?flowArguments=[{“label”:”Id”,”dataType”:”String”,”value”:”5001n00001kdDnVAAU”},{“label”:”Key”,”dataType”:”String”,”value”:”00001136″}]

As you can see, it runs the flow without opening an Experience page. For example, Salesforce Time logo doesn’t appear here, because it was from the page and not from the flow itself.

Passing parameters using Flow Arguments

This is also a great option and it gives you more control on the parameters. On the other hand, special characters are not an issue. However, the link is very long and it doesn’t look good. At least, it is not the perfect link that you want to send to the customers. Moreover, if the user changes a single character from the URL, it will stop working.

Summary

It is possible to add Screen Flows to Experience Cloud sites and give access to external users. Moreover, even guest users can use the flows in public pages.

It is a good practice to pass parameters from the URL and make the flow dynamic. By doing so, you can let the external users (and even guest users) access correct data. For example, you can build a flow to be used as a customer satisfaction survey. Then send a custom generated link to the customer when a case is closed. Using this flow, customer can fill out a survey and you can create a record or update the answers on the case. Since it is related to a specific case, it is crucial to pass some unique parameters from the URL.

Since parameters are exposed, 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. For example, if you are passing only the case number, it is easy to change the number and access another case record. However, if you pass both the case number and case Id, it will be almost impossible to guess both of them at the same time.

1 Trackback / Pingback

  1. Using Screen Flow to Create a Public Survey - Salesforce Time

Leave a Reply

Your email address will not be published.


*