Flow: How To Redirect Your Users When Flows Finish (retURL)

I’ve been postponing the writing of this article because, to be honest with you, I don’t use retURL for flow that often! However, it doesn’t mean that I don’t care about a good user experience. In this article, I will share three different types of redirection, including my personal favorite!

Why Redirection?

For Autolaunched Flow – Reduce The Clicks

When you finish an autolaunched flow using a button, you will see “Your flow finished” and the page stays there. Your users will have to close that window and go back to the original one. What’s even worse is when displaying the button in the current window. Your users will then have to go find the original record like in the example. Redirection can make these clicks all go away.

For Screen Flow – Prevent Unintended Runs

Redirection is a nice-to-have for autolaunched flows, but it can actually prevent errors for screen flows! Confusingly if you launch a screen flow using buttons or Lightning pages, the flow will re-run and re-run until your users close the windows. Without redirection, your uses might execute the flows many more times than intended. Like in example, the user couldn’t see the flow has finished and cloned many cases without knowing.

Different Ways To Redirect

We will present three different ways to redirect your users and what types of flow are applicable. Note that you don’t have to choose only one. You can use either one of them, or retURL + Screen, or Quick Action + Screen.

  1. retURL (Autolaunched/Screen)
  2. Quick Action (Screen)
  3. Screen Element (Screen)
retURL – When Using Buttons

retURL is a variable that you can add to the end of your flow URL when creating a button. You can use a static value which links to a specific page (ex. retURL = 5005I00000FkTTPQA3), or a dynamic value so it links to different pages based on where you launch the flow (ex. retURL = {!Case.Id}).

You can find different possible destinations in this help article, but the most common one I use is the recordId one. For example, when creating a detail page button for Case, paste in your flow URL as below.

/flow/flowName?retURL={!Case.Id}

Several important notes when using retURL:

  1. You can only use retURL in buttons, not actions.
  2. retURL is case sensitive, so make sure you type it exactly like that.
  3. We cannot use the variables in flow with retURL. If we redirect to records, it can only be the original record.
  4. If there are already a question mark in your flow URL, use & in front of retURL instead:
Ex. flow/flowName?varId={!Case.Id}&retURL={!Case.Id})

Setup

Back To List

Result

Quick Action – When Having Screen Flows

If you have a screen flow, the easiest way is to launch it with quick actions. It is now possible to use recordId in quick actions so this solution will save you a lot of time.

However, if you use Quick Actions on Case or Work Order objects, the actions will show up in Chatter if feed tracking is enabled. Check out this article for more details.

Result

Back To List

Screen Element – When Having Screen Flows

If we use the solutions above, the outcome would be quite limited. We cannot redirect to the newly created records, or the buttons might show up in a different place. So I want to introduce my favorite redirection – by using a Screen Element. I found this solution myself and not sure if Salesforce would recommend this, but it is working so well that I want to share it with you so much 🙂

It is a really nice solution that you can use for every scenario (buttons, actions, or on Lightning page), but be sure to test thoroughly before you deploy it.

* NOTE * Instead of hardcoding the URL, you can utilize the $API global variable to get the current domain. This will be extremely helpful if you are deploying your solution from the sandbox.

Result

Back To List

Is This Helpful? Check Out Flow Use Cases Or Write Us One!
Subscribe
Notify of
guest

28 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Paula

Hi, would be nice to show under retURL-WhenUsingButtons as a result for Autolaunched flow; you showed for a screen flow. I am saying this, because in my case there is a few miliseconds delay, where the name of the flows is still ugly visible. Thanks

anonymous

so helpful – tried all three and they work perfectly, thank you!!!

Jordan

Hey :), great article. Just wondering if you know of a solution which simply closes the “popup” window once a flow/user clicks “finish”. (when the flow is triggered by a custom button, URL for SF classic).

Ryan Dmello

Hi Melody,

Great article. I have a requirement to display a link to the record in the email that was triggered by the flow. Do you know how this can be accomplished? I read somewhere that $Record.Link merge field can be used on the email template but I can’t seem to find it.

Matthias Schmitz

Great article, thanks Melody!

Leonardo Cesar Nascimento

Hello, Melody!

First of all, excellent article and blog!

I have the following scenario: I created a Flow that is available in a listview button. The user selects the records and when clicks on the button, the Flow updates a field in these records. In this scenario, is it possible to redirect the user back to the listview or to another listview?

Leonardo Cesar Nascimento

Wow, it worked! You can’t imagine how happy I am now! Thank you very much for the help!!!

Savita

How do you find the listviewid for a custom object on a related list for the account?

Lloyd

Hi!
Great article and excellent blog! I find myself here often and it’s extremely helpful.
I have a use case for the 3rd option you presented, I have a screen flow that prompts the user to create an opportunity and I would like to take them directly to the newly created op.

I tried hardcoating the url with {recordId.Id} as you did in your example but flow gave me an error saying I couldn’t use merge fields.

How do I use the $API Global Variable as you mentioned? Would be nice to have an example of how to apply this.

Thanks!

vaibhav jindal

hii

vaibhav jindal

helpful article, can we reeduce button click and autolounched flow at the end redirect to specific URL. how?

Will

Darn good info. Thanks

tim

Hi! I Use the retURL and this works, but the result of my flow is not showing up on the page. Is there any way to reload the flow after it finished? As manually reloading helps load the result of the flow. Kind regards,
Tim

Leigh H

Hi Melody,
thanks for the great content. I have a very simple flow which Assign current user as owner and update s the Opportunity Stage. I really don’t want any extra clicks for the User so came across your solution.

I’ve an auto triggered flow and this is my button URL. The flow runs but the page still doesn’t refresh. Any ideas much appreciated!

/flow/Opportunity_Assign_and_Process_Auto_Launch?recordId={!Opportunity.Id}&retURL={!Opportunity.Id}

Jennifer Kilman

I can get my retURL to open the related list where the button resides, but I cannot figure out how to open the newly created record…???

Antonija

Hi. How do you redirect to the record?

Meg

This is very helpful, but hoping you may have a suggestion to help my scenario. I am triggering a screen flow from a button on my list view page. The flow is creating a new lead. Is there any way to return to the newly created lead? I been successful in using the return actions from record pages, but I can’t seem to get this to work from the list view page. Thank you!!

Ele

Hi, how can redirect to new record that I created in the flow? The flow is creating a new Opportunity. Is there any way to return to the newly created Opportunity from a list botton? 

andrew e

FYI: For option 3 “screen element” with a URL in the display text component, make sure you have either the pause or finish buttons selected, then uncheck the ‘Show Footer’ setting.

Because even if you UNCHECK the “Show Footer” setting, you won’t be able to save the flow if you also select to hide all the navigation buttons.

screenshot_saveflow_error_hidenavbuttons.jpg
Last edited 7 months ago by andrew e