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.

  • 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 '14 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 '14 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 '16 at 17:22
1

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

| improve this answer | |
  • Still getting the same error. – Monish Mar 27 '17 at 7:27

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.