0

This question already has an answer here:

I am receiving the following error 'Web service callout failed: WebService returned a SOAP Fault: System.CalloutException: Callout loop not allowed'. My code is as follows:

pageReference pdf = Page.viewPDF;
pdf.getParameters().put('id',commDocIds[0]);
Attachment attach = new Attachment();
Blob body;
body = pdf.getContent();

And this code is inside a loop. I thought that only soql and dml isn't allow in loop, but now this weird error. How can i solve this ?

marked as duplicate by Vamsi Krishna, crmprogdev, dphil, cropredy, Adrian Larson Sep 2 '15 at 16:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Unfortunately there is no solution yet. As of Summer 15, Salesforce have implemented a critical update PageReference getContent() and getContentAsPDF() Methods Treated as Callouts". If enabled, the following error will be raised: "(304497466)|FATAL_ERROR|System.CalloutException: Callout loop not allowed"

A temporary workaround might be to deactivate the Critical Update.

Setup > Build > Critical Updates

A similar question was raised on Salesforce Discussion Forum.

  • For the time being, i think that disabling the critical updates is sufficient for me. Thanks – vanessen Sep 2 '15 at 12:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.