function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
John Neilan 2John Neilan 2 

Error in Embedded Visualforce Page Flow

I have created an embedded Visualforce page to replace the "New" button on the Account object. The page calls a Flow, in which the users is able to check off checkboxes. The finish location of the Flow is designed to be 1 of 2 locations, dependent upon the user's selection(s). However, when I click the New button, I get the following error:

Visualforce Error
System.NullPointerException: Attempt to de-reference a null object
Class.VF_AcctNewCreate.__sfdc_TypeOutput: line 26, column 1
Class.VF_AcctNewCreate.__sfdc_SFId: line 15, column 1


Can anyone help explain why?

VF Page:
<apex:page standardController="Account" Extensions="VF_AcctNewCreate">
    <flow:interview name="Account_Create_Flow" interview="{!myFlow}" finishLocation="{!SFId}" />
</apex:page>
Controller:
public class VF_AcctNewCreate{

    private final Account acct;
    public VF_AcctNewCreate(ApexPages.StandardController myController){
//        acc = new List<Account>();
        acct=(Account)myController.getrecord();
    }

public Flow.Interview.Account_Create_Flow myFlow { get; set; }


// Factor your PageReference as a full GET/SET
public PageReference SFId {
  get {
  PageReference prRef = new PageReference('/' + TypeOutput);
  prRef.setRedirect(true);
  return prRef;
  }
  set { SFid = value; }
  }

// Factor your Flow output variable pull as a full GET / SET
public String TypeOutput {
  get {
    String strTemp = '';
    String CT = myFlow.CustType;
    String ID = myFlow.AccountId;
//    String CT = string.valueOf(myFlow.getVariableValue('CustType'));
//    String ID = string.valueOf(myFlow.getVariableValue('AccountId'));

    if(CT == 'Engage') {
      strTemp = '/' + ID;
    }
  else{
    strTemp = '/apex/AccountCreate?id=' + ID;
  }

  return strTemp;
  }

  set { TypeOutput = value; }
} 
}


 
Andy BoettcherAndy Boettcher
Try using the "getVariableValue" method of the Flow object:
 
myFlow.getVariableValue('CustType');
John Neilan 2John Neilan 2
Thanks Andy.  I did try that (uncomment lines 28 and 29 above) but I still get the same error.  Any idea why?
Andy BoettcherAndy Boettcher
Do you have the variables defined as "OUTPUT" or "INPUT/OUTPUT" in your Flow?
John Neilan 2John Neilan 2
They are both Input/Output.