I have a custom button on the Opportunity object that launches a Visualforce page. The Visualforce page passes the Opportunity ID to the Flow then launches it and sets the finish location. I know my Flow works properly because I have tested it outside the button and it works as expected. When I run the button I get the error below and I don't think the Opportunity Id is being passed to the Flow. Can anyone see what I am doing wrong?

VF Page:

<apex:page standardController="Opportunity" tabStyle="Opportunity" extensions="NewQuoteController">
  <flow:interview name="Create_New_Quote" interview="{!NewQuoteFlow}" finishLocation="{!Finish}">
      <apex:param name="OppId" value="{!Opportunity.Id}"/>


public class NewQuoteController{

    public NewQuoteController(ApexPages.StandardController myController){}

  public Flow.Interview.Create_New_Quote NewQuoteFlow {get;set;}

  public PageReference Finish {
    get {
      PageReference pageRef = new PageReference('/' + NewQuote_Id);
      return pageRef;
    set { Finish = value; }

  public String NewQuote_Id {
    get {
      String strTemp = '';

      if(NewQuoteFlow != null) {
        strTemp = string.valueOf(NewQuoteFlow.getVariableValue('NewQuoteId'));
      return strTemp;

  set { NewQuote_Id = value; }

enter image description here

enter image description here

  • Have you captured a debug log? Is the error occurring in your Apex or in your Flow? – David Cheng Aug 9 '19 at 0:06
  • Nothing appears in my debug log as an error. I've added the error message I am getting to the original post. When I run the Flow from a button with "/Flow/Create_New_Qote?OppId={!Opportunity.Id}" it works as expected. The problem must be with the VF page and/or Controller, I assume. – J. Neilan Aug 9 '19 at 0:11
  • I'm confused - your first paragraph says you're getting a dereference null object, but your screenshot is something else. Are you getting two errors or just one? – David Cheng Aug 9 '19 at 0:21
  • I was getting 2, but I fixed the null error. Sorry for the confusion. I've edited the post – J. Neilan Aug 9 '19 at 0:35

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.