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
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');
        else
            b = pdf.getContent();

and Line 2226 is 

 public PageReference SubmitHavePricing() {
        PageReference pr = null;
        if (Submit(false)) {
            pageController.getRecord();
            pr = Page.OpportunityForms;
            pr.getParameters().put( 'id', opp.Id );
            pr.setredirect(true);
            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.  
Neetu_BansalNeetu_Bansal
Hi Douglas,

You can refer this:
http://releasenotes.docs.salesforce.com/en-us/summer15/release-notes/rn_vf_getcontent_callout_cruc.htm

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

Thanks,
Neetu
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)
280z280z
Has someone figured out how to update their code to handle this?