Easily generate pre-filled URLs using Salesforce Flow — a go-to automated data-collecting solution! See below on how to successfully set up and manage Salesforce Flow within your Forms for Salesforce. Let’s get started!
Setting up a successful Salesforce Flow is done in two parts:
- Customize and publish the form
- Configure the Salesforce Flow
Please note: If you are using this process to merge over a hundred documents at once, you can easily run into the Salesforce Apex Flex Queue limit of 100 jobs. In this case, it is recommended that you utilize custom programming to generate documents in batch as detailed in this article.
Part 1: Customize and publish form
1. Add custom URL field to Primary Object
First, to successfully create Dynamic Pre-fill Links via a Salesforce Flow, you will need to set up a custom URL field on the Primary Object. This is a necessary prerequisite to provide your generated prefill link a landing place.
From Setup, search for Object under “Fields and Relationships.” Here, see if an unused URL field exists or create a new one.
2. Build and publish form
After you have set up the custom URL field on the Primary Object that you are using on the form you are working with, build out the remainder of the form.
After you have set up your form, select Publish Draft to update the form.
3. Toggle the dynamic pre-fill on
Lastly, toggle on the “Dynamic Pre-Fill” to populate your form’s objects with existing information.
From Publishing Options, toggle to turn on the field:
Part 2: Set up prefill URL using Salesforce Flow
1. Navigate to Salesforce Flow
From Setup (gear icon), in Search, type “Process Automation” to locate and select Flows.
2. Set up Flow
Step 1: Click New Flow and select “Record-Triggered Flow” from the available options.
Step 2: From the Configure Start pop-up, type in the Primary Object under Select Object and when to start the flow under Configure Trigger. Make sure the primary object you select is the same as the primary object being used on the form you are creating the flow for.
Step 3: Set up any conditions (optional) and click Done to capture the configurations.
Note: While setting up conditional requirements is optional, it is helpful when a record is updated for an optimal experience in Salesforce Flows.
Step 4: Add an action. Select the Element (+ sign) and choose Action:
Then search for “Formstack - Generate Prefill Link” or “Apex” to easily find and select the “Formstack - Generate Prefill Link” option.
Step 5: Fill out the action.
From the New Action Screen, type in the Label to fit your naming convention and the API Name will auto-populate.
Note: It's important to check if Salesforce has automatically added an "&" to the end of the Form Record ID and making sure it is removed for the flow to work properly.
Then toggle on input values, and enter the custom information into each value type:
- Action Type: Apex
- Apex Class: VisualAntidote__ProcessBuilderGeneratePrefill
- Apex Variable - formRecordId: From the dashboard, click Preview (eye icon) and copy the ID from the URL. The ID is everything after the equal (=) sign.
- Apex Variable - prefillFieldAPIName: The API name of the custom field you created on your primary object to store this prefill link you are generating.
- Apex Variable - sfRecordId: [Primary Object API Name].Id (in format: {!$Record.id})
- Apex Variable - hostedURLPrefix: set to “Don’t include”
Once filled out, select Done to capture the actions.
Step 6: Save and activate the Salesforce Flow.
Click Save.
Next, enter a Flow Label and select Save. Salesforce will automatically generate the API name.
Lastly, select Activate to turn on the Salesforce Flow.
Manage existing Salesforce Flows
Manage your Salesforce Flows from Setup (gear icon) > Process Automation > Flows.
Here, all viewable flows are listed to select and take action on including the ability to deactivate, save as a new flow to edit for another Forms for Salesforce form, edit an element, and debug.
Sending a Forms for Salesforce Dynamic URL in a Salesforce Email
If, as part of your process, you want to send an email from Salesforce that includes a dynamic Forms for Salesforce URL:
- Setup your email using a Salesforce template
- If you want to be able to edit the display name of the URL, be sure to choose a custom email template (not an HTML email template)
- In the custom template, use an tag where the href attribute should point to the url field and the actual text enclosed within the tag should be the display text
Have any further questions? We’re here to help! Please reach out to support@formstack.com for additional assistance with your use case.
Are you looking for consultation or help building out your use case(s)? Team up with third party Certified Formstack experts to bring your custom projects to life.