flow used :
I have a flow which is having a variable (I/O) .I am using this variable in a flow and a controller. The flow needs to redirect the user to the particular record when the flow ends. Things doesn't go well when we run the flow on first attempt it get redirect to start point when flow ends how ever when we click next again and redo the steps it results in redirecting successfully.
VF Page:
<apex:page controller="ContactSimple"> <br>
<flow:interview name="Survey_customers" interview="{!myflow}" finishLocation="{!Router}"> <br>
</flow:interview><br>
</apex:page><br>
<br>
Controller:
<br>public class ContactSimple {public Flow.Interview.Survey_customers myflow {get;set;}<br>public String firstName;public String test{get;set;}public String getFirstName()<br> {if(myflow==null) return 'na';else {return myflow.createdid;}}<br>public pagereference getRouter(){<br> PageReference p = new PageReference('/'+getFirstName()); p.setRedirect(true); return p;}}
{}
button next time. It works wonders. – Adrian Larson♦ Feb 23 '16 at 19:11