5

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.

3
  • Have you installed the Flow Starter Pack from the App Exchange? On The Power of Flow page there are 2 really good recent webinars and links to useful workbooks, an implementation guide plus 3 other related videos you may find helpful. Its difficult to troubleshoot a flow like yours without seeing the schema and the editor interface.
    – crmprogdev
    Oct 6, 2014 at 17:43
  • What have you set the variable to under input/output? - Try input/output if not already. Have you named it the same in the flow and the controller (it's case sensitive)?
    – Girbot
    Oct 6, 2014 at 17:49
  • the compiler error is because pageRef is known only within the scope of the get block. Move the definition of pageRef outside of the getter.
    – cropredy
    Oct 22, 2016 at 17:22

1 Answer 1

1

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

1
  • Still getting the same error.
    – Monish
    Mar 27, 2017 at 7:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .