Control What Happens When a Flow Interview Finishes

By embedding a flow in a custom lightning-flow component, you can shape what happens when the flow finishes.

To use this component, build a flow with the Salesforce Flow Builder first. The component includes the navigation buttons Back, Next, Pause, and Finish.

If your flow has custom Lightning web components or Aura components, then you can’t use lightning-flow on Experience Cloud sites that use Lightning Web Runtime.

By default, when a flow user clicks Finish, a new interview starts and the user sees the first screen of the flow again. By embedding a flow in a custom lightning-flow component, you can shape what happens when the flow finishes by using the onstatuschange event handler.

  • To redirect to another page, use the Navigation service.
  • To control what happens when an auto-launched flow finishes, check for the FINISHED_SCREEN status.

This example redirects the user to a case created in the flow by using the lightning/navigation NavigationMixin.Navigate method.

For more information, see Navigation.