I have a flow in SalesForce which creates a new object record and populates its fields. I then set a variable vAddendumId
in the flow. I would like to be able to reference that Id
on the corresponding VisualForce page controller, but I'm having problems getting at it. I know how to put variables into the flow from my page via URL "get" but I can't figure out the opposite direction.
Here's the code that I have now which assigns the Opportunity Id
from oid
in the URL string:
VisualForce Page:
<apex:page Controller="AddendumEntryController" TabStyle="Addendum__c">
<flow:interview name="Addendum_Entry" finishLocation="{!backToAddendum}" >
<apex:param name="vOpportunityId" value="{!opptyId}"/>
</flow:interview>
</apex:page>
Controller:
public with sharing class AddendumEntryController {
public ID getoppId = System.currentPagereference().getParameters().get('oid');
public Flow.Interview.Addendum_Entry AddendumEntryFlow{get;set;}
public String getOpptyId(){ return getoppId; }
public PageReference getBackToAddendum(){
PageReference send = new PageReference('/' + getaddendumId);
send.setRedirect(true);
return send;
}
}
My endgoal is to send the user to the newly created object record when the flow is complete. Which means that I need to populate getaddendumId
with the id from the flow.
Thanks in advance for any help given!
EDIT - Addition
I have tried a couple more things, one of which seems to be promising but is still throwing an error. I tried setting the variable equal to AddendumEntryFlow.vAddendumId
. This gave an error about dereferencing a null object. I believe this is because vAddendumId
is not set until later in the flow, but I can't be sure.
public Flow.Interview.Addendum_Entry AddendumEntry{get;set;}
public ID getaddendumId = AddendumEntry.vAddendumId;