You need to sign in to do that
Don't have an account?
frankcse
Updating Accounts
Hi,
Please any one can help me for the following Query?
In one of My application i am updating SalesForce Accounts using update method of sforceservice class. And i am using arry of account object.
My Question is How many records i can hold in this array.... I mean i want to know the size of the array
At a time how many records i can update using update method?
Is there any limitation for the number of records to be updated at a time?
I want to update more than 3000 records at a time..
Please help me for this
Thanks
Regards
Franklin
I find a small accumulator object really handy for managing this, something like
class updateAccumulator {
updateAccumulator(sf.SforceService s, int maxPerBatch) {
this.svc = s;
this.max = maxPerBatch;
this.objects = new ArrayList(this.max);
}
private sf.SforceService svc;
private int max;
private ArrayList objects;
void update(sf.SObject o) {
objects.add(o);
if (objects.count() >= max) flush();
}
void flush() {
if (objects.count() == 0) return;
sf.SaveResult [] sr = svc.update(objects.ToArray());
foreach(sf.SaveResult res : sr)
if(!sf.success) throw new Exception(sf.Error[0].StatusCode + " " + sf.Error[0].Message);
}
objects.clear();
}
sometimes this can make the batching easier, depending on how you need to handle errors.