Tuesday, July 19, 2016

Developer: Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking.

Recently while trying to solve a "Too many DML rows.." error, I ran into the following
error "Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking."

This error occurs when sObject contains more then 10  object types or combinations.

Basically, to work around the "Too many DML rows" error, I had created a @future method with a single delete DML statement on an sObject which had different objects in it.

To work around this chunking error, I had to create seperate @future calls from the same method based on specific Object Type. This resolved the erorr.

Wednesday, July 13, 2016

Developer: Salesforce Order of Execution of things...

Every once in a while you run into a issue which does not make sense.

I created a simple WF rule which would not fire at all. After careful evaluation, I realized that the one of the fields that I was checking for was being set thru an Approval process. Prior to this, 3 other fields on the same object were being updated, the After Update trigger on the concerned object would fire but the workflow would not.

I did the usual checks on moving the rule to execute on "Created and Edited" and found that my conditions were good.

On checking the Approval Process, I found that the Re-Evalute WF rules on update was unchecked.
On checking this flag, everytime the field was updated thru the Workflow Process was getting evaluated and executed.