You are here:
Customize a Flow URL to Control Finish Behavior
By default, after a user finishes a screen flow, the screen flow redirects the user to the first screen. If you want to redirect users to another page within Salesforce when they click Finish, use the retURL parameter in the flow URL.
Required Editions
| View supported editions. |
Format
To redirect users in a screen flow to a specific page in Salesforce after they click Finish, use this format.
/lightning/flow/flowName?retURL=urlThe url is a relative URL (the part of the URL that comes after https://MyDomainName.my.salesforce.com/ or https://MyDomainName.lightning.force.com/).
For example:
- Create or identify the screen flow that you want to customize.
- Determine the destination URL where you want the flow to redirect users to after they click Finish on the final screen.
- Append
?retURL=urlto the flow URL, where url is the relative URL of the destination page. - If you're also passing input variables to the flow, add the retURL parameter after the variable parameters, separated by
&. For example:/lightning/flow/MyFlow?flow__varCaseId=500xx000000abc&retURL=lightning/page/home. - Use the complete URL with the retURL parameter in your button, link, or component.
URL Options
Redirect flow users to these Salesforce URLs.
| Redirect Destination | Relative URL | Example |
|---|---|---|
| Chatter | _lighnting/page/chatter/ | lightning/page/chatter/ui/ChatterPage |
| Home page | lightning/page/home | lightning/page/home |
| List view | Lighting Experience: o/object_name/list?filterName=API_name Pinned list view: lightning/o/object_name/list Classic: objectCode?fcf=listViewId |
Lightning Experience: lightning/o/Case/list?filterName=MyCases Classic: 006?fcf=00BD0000005lwec |
| Object home page, such as Accounts home | objectCode/o | 001/o |
| Specific record, such as a contact, report, dashboard, user, profile, or Chatter post | recordId | 0D5B000000SKZ7V |
| Visualforce page | apex/pageName | apex/myVisualforcePage |
| Web tab | servlet/servlet.Integration?lid=webTabId | servlet/servlet.Integration?lid=01rD0000000A88h |
- Object
codes are three-digit prefixes that identify standard and custom objects in Salesforce.
Look at the object's record ID prefix in the URL or in the object's details. For example,
Account objects use the prefix
001, Case objects use500, and Opportunity objects use006. Alternatively, create a test record of the object type and examine the first three characters of the record ID. The object code matches those three characters. - For Salesforce Classic URLs, Salesforce redirects your users to the right page in whichever Salesforce experience they’ve enabled—Lightning Experience or Salesforce Classic. If the page doesn’t exist in Lightning Experience, Salesforce redirects the user to the page in Salesforce Classic.
- For Lightning Experience URLs, Salesforce always redirects your users to the home page
in Lightning Experience (
lightning/page/home), even if the user has Salesforce Classic enabled. Users who don’t have permission to access Lightning Experience see an error message. - Web tabs in Lightning Experience can redirect only to Visualforce pages.
- When
you pass a record ID in the URL, for example,
flow__varCaseId=500xx000000abc, the behavior depends on the flow variable type in your flow:- For a text variable, Salesforce passes the record ID as a text string. The flow
receives the ID value, for example,
500xx000000abc. - For a record variable, Salesforce attempts to pass the entire record object. However, passing a record ID in the URL doesn't automatically load the full record. The flow receives the ID, but you must use a Get Records element in your flow to retrieve the full record data based on that ID.
- For a record variable that passes only an ID, the flow may fail if it expects record fields that aren't provided. Always use a Get Records element after receiving a record ID to populate the record variable with the necessary fields.
- For a text variable, Salesforce passes the record ID as a text string. The flow
receives the ID value, for example,
Limitations
- You can’t redirect flow users to a URL that’s external to your Salesforce org.
- You can’t use a flow variable as the value for the retURL parameter. To use a flow variable to redirect a user, such as to a specific record, distribute the flow using Visualforce.
- retURL can cause nested top and side navigation bars to render on the destination page.
- If you don’t add
/lightningto the beginning of the flow URL, retURL is case-sensitive. If you use retUrl, the URL doesn’t redirect the user. - Action Button screen components don’t support the retURL parameter.
Examples
Before you customize the button URL on the Case object, the button launches a flow. When users finish the flow, they're redirected back to the flow's first screen.
/lightning/flow/Case_Update_FlowYou then customize the button URL to redirect users to the Case list view after they finish the flow.
/lightning/flow/Case_Update_Flow?retURL=500/oTo customize the button:
- In Setup, click Object Manager.
- Click Case, and then click Buttons, Links, and Actions.
- Find your custom button, and click Edit.
- In the URL field, add ?retURL=500/o to the end of the flow
URL.
NoteThe
500is the object code for Case. - Click Save.
This flow URL redirects users to Accounts home, which exists in both Lightning Experience and Salesforce Classic.
/lightning/flow/myFlow?retURL=001/o When Lightning Experience users finish the flow interview, Salesforce redirects them to
http://MyDomainName.lightning.force.com/lightning/o/Account/home.
When Salesforce Classic users finish the flow interview, Salesforce redirects them to
http://MyDomainName.my.salesforce.com/001/o. Either way,
Salesforce redirects users to Accounts home in their respective experience.
This flow URL redirects users to a Visualforce page that exists only in Salesforce Classic.
/flow/myFlow?retURL=apex/myPageWhen users finish the flow interview, Salesforce redirects them to http://MyDomainName.my.salesforce.com/apex/myPage in
Salesforce Classic. When they navigate away from the Visualforce page, Salesforce reverts to
their original experience.
For instance, after viewing the Visualforce page, users go to the home page. For Lightning
Experience users, Salesforce renders the Lightning Experience home page
(http://MyDomainName.lightning.force.com/lightning).
For Salesforce Classic users, Salesforce renders the Salesforce Classic home page
(http://MyDomainName.my.salesforce.com/home/home.jsp).
This flow URL sets the varUserFirst and varUserLast variables (both of type Text) to the running user’s FirstName and LastName field values. When the flow interview finishes, it redirects the user to the home page for the enabled Salesforce experience.
/lightning/flow/User_Info?flow__varUserFirst={!$User.FirstName}
&flow__varUserLast={!$User.LastName}&retURL=home/home.jsp
