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 🙂

Please wait while flipbook is loading. For more related info, FAQs and issues please refer to DearFlip WordPress Flipbook Plugin Help documentation.

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
0 Comments
Inline Feedbacks
View all comments