I have an embedded Visualforce page designed to replace the "New" button on the Account object. The page calls a Flow, where users are able to check off checkboxes for the type of Account. The finish location of the Flow should either be the standard Account edit page or another custom VF page, 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}" />


public class VF_AcctNewCreate{

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

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);
  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;
    strTemp = '/apex/AccountCreate?id=' + ID;

  return strTemp;

  set { TypeOutput = value; }
  • Is the flow variable "AccountId" defined as "Input/Output" or "Output Only"? If it's "Input Only" or "Private" this will fail. – Christian Carter Nov 24 '15 at 17:41
  • No, both variables are defined as Input/Output in my flow. – J. Neilan Nov 24 '15 at 17:57
  • 1
    I suggest you add debug statements to see if the SFId get is called (that in turn references TypeOutput that uses myFlow) before the myFlow set is called. I don't think you can rely on any specific order of those property accesses. – Keith C Nov 24 '15 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.