This may be useful for someone who is trying to make an efficient code on force.com platform. We all know that there is a limit on DML operation on force.com in a transaction, just 150. We may want to write much DML operation on different objects. Let’s say if you have accounts, contacts and you want to update /insert these objects in the same context, how we can save DML operations if the number of records in combined list cannot cross 10,000. There is a solution with generic Sobjects in sales force.
So we have list of accounts, contacts.
Account_list = new List (); List Contact_list = new List (); /* Some logic to populate account, contact data and finally you want to perform DML operation on account and contact. Let’s say an update. */ List Update_list = new List (); Update_list.add(Account_list); Update_list.add(Contact_list); Update Update_list; /* This will save one DML operation*/
Hope this can help someone who is close to DML limit.