+ Start a Discussion
Douglas TrasterDouglas Traster 

Critical update issue for getContent() and getContentAsPDF()

I am completely at a loss.  There is no documentation that tells me how to fix this issue.  I turned on the Critical Update in a sandbox and got the following:

I get the following error:
Error is in expression '{!submitHavePricing}' in component <apex:commandButton> in page formpricingsummarypg: Class.EmailFormWithAttachments.SendPricingFormEmail: line 50, column 1
Class.FormPricingSummaryCls.SubmitHavePricing: line 2226, column 1

The code at line 50 is :
      // Take the PDF content
        Blob b;
        if (Test.isRunningTest())
            b = Blob.valueOf('Test');
            b = pdf.getContent();

and Line 2226 is 

 public PageReference SubmitHavePricing() {
        PageReference pr = null;
        if (Submit(false)) {
            pr = Page.OpportunityForms;
            pr.getParameters().put( 'id', opp.Id );
            EmailFormWithAttachments.SendPricingFormEmail(f.id, false);

Basically, the 2226 is just calling the PDF to email to you when you hit submit on the VisualForce Page.  

If I turn off the critical update it works.  
Hi Douglas,

You can refer this:

As after enabling critical updates, getContent() and getContectAsPdf() are treated as callouts. You need to do the changes accordingly.

Douglas TrasterDouglas Traster
Neetu, I am not sure what changes need to be made? I have read your attachment and not getting what changes need to be made. My code works without turning on the update, but fails after I turn it on. Sent with Good (www.good.com)
Has someone figured out how to update their code to handle this?