You need to sign in to do that
Don't have an account?
Zoom_V
Making the FinishLocation of a Flow as the newly created Record
I am creating a new record using Screen/Create Record elements of a Flow. I am starting that Flow with a customized New button. I am now attempting to make the FinishLocation as the newly created record. Here is the VF page which I am referring to with the New button in order to kick off the Flow :
and the class which is the Extension is this :
<apex:page standardcontroller="Vendor_Profile__c" Extensions="New_Vendor_With_Flow_Controller2"> <flow:interview name="New_Vendor_Profile"/> </apex:page>
and the class which is the Extension is this :
public class New_Vendor_With_Flow_Controller2 { public New_Vendor_With_Flow_Controller2(ApexPages.StandardController controller) { } public flow.interview.New_Vendor_Profile myFlow {get;set;} public New_Vendor_With_Flow_Controller2() { } public String getendID() { if (myFlow !=null) return myFlow.VarRecordID; else return 'home/home.jsp'; } public PageReference getFinishLocation() { System.debug('VarRecordID ########'+myFlow.VarRecordID); PageReference endlocation = new PageReference('/' + getendID()); return endlocation; } }
I am attempting to use the VarRecordID variable which I set in the Create Record element in the Page Reference.
I don't think I need to set a FinishLocation in the VF page, do I ? If I set that it will only go to that spot at the end of the Flow. I don't think I can refer to the VarRecordID variable in the FinishLocation so I didn't set one.
Anyone have any suggestions on this ?
In you class you can write
Hope this helps. Best.
Thank you very much for your input. I tried altering the code to what you suggested and I would get an error "Error: Unknown property 'Vendor_Profile__cStandardController.navigateToNewRecord'". As I have it now I changed the VF page line to : "<flow:interview interview="{!myflow}" name="New_Vendor_Profile" finishlocation="{!finishlocation}"/>" and am getting this error : System.NullPointerException: Attempt to de-reference a null object
Class.New_Vendor_With_Flow_Controller2.getFinishLocation: line 20, column 1.
I'm completely baffled on how to fix this. I appreciate any input I can get.
Thanks again
Thank you
Thank you for all of your help.