Closed RBLopez closed 7 years ago
are you sure you are adding 12 unique objects to DML Wrapper? the first thing that groupSObjects() does is remove duplicate objects. Other than that, I doubt that groupSObjects() is doing the wrong thing, since we use it internally, and it is all generic (ie, not npsp or standard object specific). You could copy the code of groupSObjects() to your org and run it yourself with your data to prove whether it is at fault. code is here: https://github.com/SalesforceFoundation/Cumulus/blob/dev/src/classes/TDTM_Runnable.cls#L149
Hi @RBLopez in the future, feel free to post this to the NPSP Group in the Hub and we can troubleshoot it with you there. Thanks!
I'm running into an issue using the TDTM structure when trying to use the DMLWrapper class to insert objects.
I've successfully run through my logic and generated a list of additional objects that I would like inserted. I used the example code here (http://developer.salesforce.org/#blog/post/2016/06/10/table-driven-trigger-management.html) as my guide on how to add my records to the DML wrapper, and have confirmed in my test code that I'm adding 12 rows to objectsToInsert list in the wrapper. However, there is only 1 record being inserted by the TDTM code.
My guess is that somehow the groupSObjects method is causing this behavior? See the screenshot of my error log here (I also have the full logs if you want them). Should I be adding items to the wrapper in some other way to make sure that this doesn't happen?