mulesoft/salesforce-connector — Issue #21: Support batchSize option for DML operations
Author: jonathansnd
Created: 2012-01-06 17:07:33+00:00
State: open

This probably is made this way by design, but currently there's no way of specifying batch size for dml operations. If someone tries to use a non-bulk dml operation components and you have a list with more than 200 records you get an error because SF only supports batches of up to 200.

A workaround for this is to create a a batch splitter operation and set a batch size at this point, however, it would be nice if the dml component itself could have a parameter to specify the batchSize and handle batch partitioning internally.

So instead of having something like this:
```

Collection.metaClass.partition = { size ->
def rslt = delegate.inject( [ [] ] ) { ret, elem ->
( ret.last() << elem ).size() >= size ? ret << [] : ret
}
if (rslt.last()?.size() == 0) rslt.pop()
return rslt
}

def origList = payload
return origList.partition(200)

```

You could just use the following:

```

```

It's very important to have control of batchSize in Salesforce, although developers should always look to use the max size to reduce the number of API calls sometimes there's very complex business logic attached to triggers and you have no other option than to reduce the number of records that are processed in a bulk operation to avoid hitting governor limits.