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
Ethan AdshadeEthan Adshade 

Help with Apex Triggers and HTTP Callouts being delayed.

We have an application that is making use of Apex Triggers and HTTP Callouts to notify our web service when an action happens in Salesforce.

For example:

1. An admin in Salesforce changes a `School` object
2. The Apex Trigger for the `School` object makes an HTTP Callout to our website

During testing the HTTP Callout happened immediately after the object was changed, usually in under 1 second. However, recently we are noticing that it is taking anywhere from 10 seconds to 200 seconds for the HTTP Callout to happen, e.g:

1. An admin in Salesforce changes a `School` object
2. ...100 seconds pass...
3. The HTTP Callout is made

Why is this? The Apex Trigger documentation does not mention any sort of delay in executing the HTTP Callout, and the delay is inconsistent: sometimes it is a few seconds and sometimes it is a few minutes. Our longest documented instance is ~200 seconds from the action happening to the HTTP Callout being triggered.

Hi Ethan,

Are you using @Future Method for HTTP Callout in trigger or you are using the scheduler?
If you are scheduling the request then check at what time it get schedule after trigger execution.

Please mark this answer as SOLVED and BEST ANSWER if it helps you.

Yogesh More

Salesforce consultant || Salesforce Developer || Skype:-yogesh.more44