Redirect Flow Finish Location to New Record Detail

One of the most common requests for Salesforce Flows is to push the user to the detail page of the new record being created inside flow.
This is quite easy to achieve by wrapping your flow in a Visualforce page and passing the Id of the new record into the VF Controller.

Lets first embed the flow inside a VF Page:

The interview attribute is used to link to the flow instance in the controller class.

Now lets look at the controller class:

So Assume that you have set a output variable in flow that is called newFlowRecordId and its value is the record id of the new record.
So simply put the VF Page will set the finish location for the linked flow to that set in the controller class. The value we have set in the controller is just the detail page of the new record.
It could of cause be any value you send back from flow, so you could pass a string for different situations your flow might end up in and then set the location accordingly.

2 thoughts on “Redirect Flow Finish Location to New Record Detail

  • June 5, 2017 at 10:42 pm

    Hi. Great article! I keep getting the following error when trying to save the controller:
    Error: Compile Error: Variable does not exist: pageRef at line 12 column 10
    Also, is there a value to flowInstance?
    Any ideas?

  • April 12, 2018 at 1:10 pm

    Excellent blog post. I definitely love this site. Keep it up!


Leave a Reply

Your email address will not be published. Required fields are marked *