+ Start a Discussion

Batch Update of Objects causes operation time out


I am trying to update large amounts of data to salesforce.
Basicly, i pull down every account we have (26000 currently), reach some conclusion, and update all 26000 after.

Now, everything works fine untill i try update such a large quantity, then i get the Exception 'The operation has timed-out.'

To update this, i have created a method, where i pass an array of Salesforce objects.
I then break these down into sets of 200 and run the sforceservice.update on each batch.
Its this method which times out.
My Code looks something like this:

public static bool UpdateBatchLarge(sforce.sObject[] objecstosave)
 //Create a sforceservice
 sforce.SforceService sforceservice = new sforcecommon.security([MyUserName], [MyPassword]).SforceService;
 //break the array down into arrays of 200 (the limit)
 Utilities.ArraySplitter arrsplit = new utilities.ArraySplitter(objecstosave);
 sforce.sObject[] tempArray;
 bool SUCCESS = true;
 while((tempArray = arrsplit.GetsObjectRange(200)) != null && SUCCESS)
  sforce.SaveResult[]  saveresult = sforceservice.update(tempArray);

  //Loop through the result set determining if all was successfull
  for(int i = 0; i < saveresult.Length; i++)
    SUCCESS = false;

 //return the result
 return SUCCESS;

When i lower the amount of records i'm trying to update (say to half - 13000), this does work.
Its just when i try run this on all 26000 records that i have the time out.

Is there some way i can improve how i'm doing this, or a way to specify a longer time out.

I found an article on Microsoft.com that seemed to point me in the right direction:


Is this the problem, or can i change my code to fix this.


Grant Merwtz

Message Edited by GrantM on 09-30-2005 09:57 AM

Message Edited by GrantM on 09-30-2005 09:57 AM

There's a timeout property on the .NET proxy object, which you bump up from the default.

That simple eh?



you could also try to relogin if your session timed out..! Sometimes this might result in updating the same batch again. But . this is update... Guess it doesnt matter as long as the data is not modified via other interface..




thanks for you Advice Chitra.

But Simon was onto it, its wasn't the session that was timing out, but the WebService thread.

This article sorted me out, if anyone has this same problem (ofcourse it was inspired by Simon's reply, thanks again



Grant M