top of page

How to pass URL parameter into a Community Flow

Updated: Jun 9, 2021

Overview


We were tasked with developing a way to allow a customer to fill out a custom form via a link from a Salesforce generated email. The forms needed to automate the creation of several records. None of the customers are community users.


We proposed the use of a new Public Community and Screen Flow, as we could easily access records and create new records using the built-in tools. That is all easy enough: Set up a Public Community, enable flow usage in system permissions for the Guest User Profile on the community, and finally grab a flow component and add it to the Home page on the community.


The Screen Flow needed to accept a recordId to launch the automation. Unfortunately, we didn't have the recordId to pass to the flow, as that is only available when a flow component is on a record detail page.


We needed something that we could pass to the flow that was not a recordId as this was a Public Community. So, we created a new field on the target object called Unique_Token__c. We wrote an after insert apex trigger that generated a random number, converted it to a string, and loaded it into this field.


Now the question was how to pass this value into the flow. Salesforce provides a fair amount of documentation on how to do this, but unfortunately it is not community-specific. Normally, a link takes the user to a location within the Salesforce org they are already signed into, not a community.


Proposed Process Automation


When a new record is created on the target object, code runs to autogenerate a unique number, which is added to the hidden Unique_Token__c text field on the target object. Some event at a later date triggers an email to go out to the customer. Within the email is a link to a community with a parameter included in it with the unique token. When a customer clicks the link, they are taken to the Public Community's flow page where the unique token is passed from the url into the flow. The unique token is then used in the flow as a replacement to the recordId to find the target object's record and kick off the automation.


Solution


1) Create a new page in the Public Community and set it up as a 'Flow' page. This is NOT a component on the page, but a page type. Set the flow you will pass the parameter to. Make sure you have created the UniqueToken text variable in the flow and have set it up to allow input.

2) Set up an email alert which triggers an email template.

3) Set up the email template to use the following string as a url

https://OrgLocation.com/CommunityName/s/flow/FlowName?UniqueToken=

where OrgLocation is the location of the org, CommunityName is the API name of the community, and FlowName is the API name of the flow you are passing the parameter to. Keep in mind that this part of the url does not need to be dynamic. Just figure it out and paste it into the email template.

4) After the equal sign in the url, you need to actually provide the value for UniqueToken. Add to the end of the url {!ObjectAPIName.Unique_Token__c} where ObjectAPIName is the name of the standard or custom object you are targeting.


Example URL: https://derrickssteakhouse.cs61.force.com/steakoptions/s/flow/ChooseSteakOptions?UniqueToken=1058359525


Let us know if you have questions or if you have derived a more simple approach.


UPDATE: We missed one step. Once the flow has been placed in the community, you will need to click on the flow component. You will now see a list of the input variables for your flow. You will need update these for any you want to be passed in. Otherwise, they will pass in as null values. For our example, the input would be {!UniqueToken} since that is the value in the URL parameter.



To get started with Cloud Pacific, go here to complete a simple form. A Cloud Pacific Account Manager will collaborate with you to clarify your needs and goals, and customize a service package and roadmap that will help your business grow and thrive on Salesforce. Reach out to us here!

11,599 views12 comments

Recent Posts

See All

12 comentários


Marco Almodova
Marco Almodova
09 de set. de 2022

Really nice post! Just to don't lose the dynamic behavior of the community Flow page, this article explains how to pass the parameters to the flow without having to select a single flow on the experience builder page: https://help.salesforce.com/s/articleView?id=release-notes.rn_networks_flow_urls.htm&type=5&release=220

Curtir

Gunjan Agarkar
Gunjan Agarkar
08 de set. de 2022

Hi

for me also I tried to set exactly same but the variable value is still null

Curtir

Raul R. Edwards
Raul R. Edwards
26 de out. de 2021

I think for step #5 (the update) you need a picture to help explain how to use the Flow variable and the URL variable from the parameters:

https://photos.app.goo.gl/nf7ShXvwXnp8VU4T7


In my example,

URL: https://MyOrg.force.com/CommunityName/s/?language=en_US

URL Variable: language=en_US

Flow Variable: v_language = {!language}

Curtir

Sascha Lo
Sascha Lo
20 de set. de 2021

Flow Page type isn't there anymore so instead of adding the flow API Name we only need to pass the variable in the URL like this:


https://derrickssteakhouse.cs61.force.com/steakoptions/s/flow?UniqueToken=1058359525


Curtir

keerthi.balki
28 de jan. de 2021

Hi Paul, Can you help to customize the URL. i couldn't find the flow page type in builder. Appreciate any help.

Curtir
bottom of page