Newer Version Available

This content describes an older version of this product. View Latest

Configuring the finishLocation Attribute in a Flow

Embedding a flow in a Visualforce page using the <flow:interview> component gives your Force.com Sites, Customer Portal and partner portal users access to the dynamic applications you've built using Visual Workflow. In addition to the other flow customizations available with Visualforce, you can also shape what happens when a user clicks Finish on the final screen.

The following sections show the ways you can configure the <flow:interview> component's finishLocation attribute.
  • If finishLocation isn't specified, users that click Finish are routed back to the first screen of the flow.
  • If you use a standard controller to display a record on the same page as the flow, users that click Finish are routed back to the first screen of the flow, without the record. This is because the id query string parameter isn’t preserved in the page URL. If needed, configure the finishLocation to route users back to the record.
  • You can't redirect flow users to a URL that’s external to your Salesforce organization.

Note

Setting finishLocation Using the URLFOR Function

You can use the URLFOR function to:
  • Route users to a relative URL, such as the Salesforce home page.
  • Route users to a specific record or detail page using its ID. For example, if you wanted to route users to a detail page with an ID of 001D000000IpE9X:
For more information about URLFOR, see Functions.

Setting finishLocation Using the $Page Variable

If you want to redirect users to another Visualforce page when they click Finish, but you don't want to use URLFOR, you can set finishLocation to simply the name of the destination page.
For more information about $Page, see Global Variables.

Setting finishLocation Using a Controller

You can set finishLocation in a few different ways with a controller. Here's some sample code for a page:
Here's sample code for the controller.
Note there are three different examples.
  • getPageA instantiates a new page reference by passing a string to define the location.
  • getPageB returns a string which is treated like a PageReference.
  • getPageC returns a string that gets translated into a PageReference.

You can't redirect users to a URL that’s external to your Salesforce organization.

Note