Help with finishLocation on flow

I have a Flow that creates a new case and I’m trying to have the last step take me to the new case. I pulled some stuff from http://www.ukprogrammer.co.uk/index.php/redirect-flow-finish-location-to-new-record-detail/ but I can’t get it to work

Here is the VisualForce Page

<apex:page controller="Simplified_CaseflowController">
    <flow:interview name="Simplified_Case" interview="{!flowInstance}" finishLocation="{!finishLocation}" >
        <apex:param name="varCurrentUserID" value="{!$User.Id}"/> 
         </flow:interview>
</apex:page>

And here is the controller

public class Simplified_CaseflowController{
// Instanciate the Flow for use by the Controller - linked by VF interview attribute
public Flow.Interview.Simplified_Case flowInstance {get;set;}

// Set the page reference accessor methods
public PageReference finishLocation {
    get {
        PageReference pageRef = new PageReference('/' + newRecordId);
        pageRef.setRedirect(true);
        return pageRef;
        }
    //set { pageRef = value; }
}

// Set the accessor methods for the flow output variable
public String newRecordId {
    get {
        String strTemp = '';
            if(flowInstance != null) {
            strTemp = string.valueOf(flowInstance.getVariableValue('CaseID'));
            }
        return strTemp;
    }
        set { newRecordId = value; }
    }
}

The controller won’t even save unless I comment out the line “set { pageRef = value; }”
Any help is appreciated.

Answer

On the line that is commented out (that currently sets pageRef = value), you need to set finishLocation = value.

Attribution
Source : Link , Question Author : user1631423 , Answer Author : Weston Sankey

Leave a Comment