Insert Records in multiple Objects in single DML

There could be many cases where you need to insert records in multiple objects in a single method but you might end up with TOO MANY DMLs Error.

Here we’ll discuss how you can insert records in multiple objects in a single dml call.

Let’s assume you need to add records in Account, Contact and AccountContact (Custom Object). By using the below code, you add records in all 3 objects in a single DML call.

Source : https://salesforce.stackexchange.com/questions/141897/insert-multiple-sobjects-in-single-dml-call

Leave a Comment