Monthly Archives: February 2014

No Callout limit and doing dmls before callout :)

In salesforce there are strict limitations on how callouts are used. Because they take much resources. One of the most important limitations which needs to be considered while doing integrations with external systems is doing DML before the callout. Salesforce does not permit doing DMLs before the callout. This post is about using PageReference.getContent()  and doing as many callout as you want and also doing DML’s before callout.

Here is the code:

Create the page as follows:

Create the class as follows:

Thats it..Now you are ready.


When you run this code in anonymous block, you can see in limit section callout counter still shows ZERO. Try doing more than 10 callouts, you will see that counter is ZERO which means you can make more than 10 callouts. 🙂

So you will get the response from this method. I tried making 24 callouts in a single transaction, which took nearly 20 seconds and code proves you can make DML’s before callout.

By this method you can make Http GET or POST callout. So this approach gives you the place where you will see some limits will not act. Like

1. DML’s will not get counted.

2. SOQL’s will not get counted.

Note: Add the urls in remote site settings. Limits in salesforce are there with good reasons. Use this only when you have no option.

[If you are not able to see code then follow this]

Feel free to leave your comments.