Sunday, 13 October 2013

How to manage discrete objects DML operation wisely

This may be useful for someone who is trying to make an efficient code on platform. We all know that there is a limit on DML operation on 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.

List 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 Update_list; /* This will save one DML operation*/

Hope this can help someone who is close to DML limit.

1 comment:

  1. Your providing such a valuabe information about studying..and also have some good key points to every

    Salesforce Interview Questions |

    Salesforce Training Videos