I have a simple Visual Flow embedded in a simple Visualforce page that creates a record in a custom object. When the flow ends, I would like to redirect to the detail page of the record that was just created (using a Flow variable). How can I reference a flow variable in the 's returnurl parameter?

VF Code


Don't include quotes around the variable name: this causes it to be interpreted as a literal string. Instead, you have to get the value from the flow itself, which means you need a controller. In your extension, add the following code:

public Flow.Interview.NewAbsence flowInterview { get; set; }
public Id getNewAbsenceId() {
    return flowInterview.newAbsenceId;

Now, modify your flow to set the flowInterview attribute:

<flow:interview name="NewAbsence" interview="{!flowInterview}" finishLocation="{!NewAbsenceId}" buttonLocation="top" />

Now, when your flow finishes, it will redirect to the Id provided in the variable. You need to make sure your flow variable is set to either "Output" or "Input and Output", or it won't work.

Edit: See this documenation for more details.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.