Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to call out my web service after the insert process of a custom object with a delay of 2 minutes. But i am getting that exception FATAL_ERROR|System.CalloutException: Read timed out How can i fix that problem ? Here is my implementation.

Callout class:

public class HttpCallout{
    public static void getContent(String url){
        Http h = new Http();

        HttpRequest req = new HttpRequest();

        HttpResponse res = h.send(req);
        String response = EncodingUtil.urlDecode(res.getBody(),'UTF-8');

    public void serviceCaller(){


trigger AfterInsertOrUpdate on Sales_Order__c (after insert) {
    System.debug('Making future call to update account');
    HttpCallout httpCallout = new HttpCallout();
    System.debug('After Insert');

Any help would be appriciated.

share|improve this question

The argument to HttpRequest.setTimout is a millisecond value so for 2 minutes:

req.setTimeout(2 * 60 * 1000);

PS With the clarification that the desire is to make the web service call after a 2 minute delay I suggest you experiment with this Need System.schedule cron string for run once approach. In your case you would build the cron string to be 2 minutes from the current date/time.

share|improve this answer
I tried that but the web service has been called out just after the insert process. – user3864408 Aug 8 '14 at 13:09
@user3864408 Perhaps a better title for your question would be "How to schedule a web service call for 2 minutes in the future". – Keith C Aug 8 '14 at 13:11
Yes it is then how can i make it ? – user3864408 Aug 8 '14 at 13:19
@user3864408 See link in PS. – Keith C Aug 8 '14 at 13:21
i didnt understand anything from the link i think this is not what i am looking for – user3864408 Aug 8 '14 at 13:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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