You need to sign in to do that
Don't have an account?
Douglas 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.
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.
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