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
grigri9grigri9 

getcontent is giving me a null pointer exception

I have the following trigger that simply calls a function in a class that gets a pdf blob.

 

 

trigger updOpportSendEmail on Opportunity (after insert, before update) { EditOpp.saveoppnew(trigger.new[0].ID); }

 

 

@future public static void SaveOppNew(String ID){ Opportunity OppObj = [select ID,StageName,AccountID from Opportunity where ID=:ID limit 1]; system.debug('*****'+OppObj.ID);

PageReference pdf = Page.Invoice_Email; pdf.getParameters().put('id',OppObj.ID); system.debug('*****before blob'); Blob pdfBlob = pdf.getContent(); system.debug('*****after blob');

}

 

The Id is getting pulled correctly and if I manually go the the Invoice_Email page for that opportunity everything works fine. Does anyone have any idea why pdf.getContent() is giving me the following exception?

 

 

System.VisualforceException: java.lang.NullPointerException

 

 

--Greg

 

Novo_ArtisNovo_Artis

Just wondering how this situation was resolved?
I'm having the same issue...

 

The manual states "getContent cannot be used in triggers"
Does this include a method from a class being called via a trigger?

Message Edited by Novo_Artis on 10-21-2009 10:39 PM
vcassvcass
If the trigger does the call, then yes.