How to pass URL parameter into a Community Flow

Updated: Jun 9

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.


#flow #flowurl #community


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!

2,791 views9 comments