+ Start a Discussion
Chris over 9000Chris over 9000 

Set flow finish location to the new case

I've looked at several posts and am stumped
  • http://techman97.wordpress.com/2013/10/18/flow-and-finishlocation/
  • http://www.ukprogrammer.co.uk/index.php/redirect-flow-finish-location-to-new-record-detail/
I can't seem to adapt the tips given for my Flow (I'm just getting into APEX, I can read a lot of it but writing it is still very rudimentary) it's called "Test_Flow" and on the last screen I have it coming back with "The case created was {!CaseCreated}" 

I thought I had all the names and variables in the techman97 example sorted out but the result page is /your/page/location?var1=null so it's just defaulting to null instead of getting the CaseCreated variable. 

public class flowController{
// Instanciate the Flow for use by the Controller - linked by VF "interview" attribute
public Flow.Interview.Test_Flow flDemo {get;set;}

// Factor your PageReference as a full GET/SET
public PageReference prFinishLocation {
get {
PageReference prRef = new PageReference('/your/page/location?var1=' + strOutputVariable);
prRef.setRedirect(true);
return prRef;
}
set { prFinishLocation = value; }
}
// Factor your Flow output variable pull as a full GET / SET
public String strOutputVariable {
get {
String strTemp = '';

if(flDemo != null) {
strTemp = string.valueOf(flDemo.getVariableValue('CaseCreated'));
}

return strTemp;
}
set { strOutputVariable = value; }
} 

}