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
Yishay Haspel 10Yishay Haspel 10 

we suddenly receive a System.CalloutException: Callout loop not allowed.

Hi all,

we suddenly receive a System.CalloutException: Callout loop not allowed.
We read about this exception and it has no meaning in our case.
1. We get it from a method that callout to an external service we need.

Http http = new Http();
HttpResponse res = http.send(request);
2. It works when we call the method synced manner.
3. When on the other hand the method is called from a future that on turn was called from a trigger we get the exception.
4. It didn't happen at the beginning of week.
5. It doesn't happen in our dev org.

Anyone got something like this and overcome it?
Thanks,
Yishay
Abhilash Mishra 13Abhilash Mishra 13

Hi,
i think when trigger is fired. it is calling your external webservice method in a loop.
You might have placed the call inside the loop that iterate over trigger context varibales.

Let me know if this helps

Regards
Abhilash Mishra

Yishay Haspel 10Yishay Haspel 10
Hi,

Abhilash Mishra, Thanks you for your reply. This exception is not about loops, but is caused when you callout to another org which in turn callout.
Amit Chaudhary, Thanks you for your reply. We callout to an external service which is not salesforce, I most mention that:
1. It works when the procedure doing the callout is called when the user request it and fails from future.
2. It works in our dev org and fails in a customer org.
3. It worked in the cutomer org in the beginning ot the week,

Many thanks,
Yishay
 
Joeri VederJoeri Veder
I suddenly had the same issue with a piece of code that had been working for over a year.. But solved it by removing the webservice callout part.

In the @future method i retrieve all my data and call pageReference.getContent(); seems to solve it.