Tuesday, May 17, 2016

Developer: Salesforce Chunking error.....what is it

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

If you have received this error then most likely you are operating with a hybrid List of Sobjects
meaning you have something like

List<Sobject> S = new List<Sobject>()

and then in this list S you are adding object records from different entities like
Accoint Lead and other Custom entities.

Sometimes incorporating a simple list.sort() method works but if this does not work then you might have to break down your list into different Lists specific to each object and then perform the operation.

Referring to this post will help understand the situation better:
http://bartoszborowiec.wordpress.com/2014/06/15/execution-failed-system-typeexception-cannot-have-more-than-10-chunks-in-a-single-operation-please-rearrange-the-data-to-reduce-chunking/

but if the sort method does not work then use seperate lists and proceed.

No comments:

Post a Comment