1

Assume I have written a after insert trigger on an object A. I do some manipulation inside my trigger and at the end I create 3 to 4 new objects , that is a related list in Object A(Master-detail relationship). This works when I create record of object A manually. So If I use a data loader to insert a list of records (in csv) of type Object A, would the trigger still work in such scenario with out hitting the governors limit? Would it be able to create 4-5 new object(related list) for every record of object A that is inserted? Assume that I do not have any DML statement in for loop.

3

TLDR: without knowing more about your architecture it is difficult to say, but simple orgs and those designed well should be able to handle it without issue for the most part.


Your consumption of governor limits is entirely dependent on your architecture. That being said, you have a few limits specifically you need to watch out for.

The most direct impact you have is on DML rows. If each master record results in an insert of 4 child records, then your consumption is used at 5x rate. So in a batch of 200 you will consume 1000 out of your 10k limit. No big deal. If those triggers then contain other cross object logic, this number can grow considerably.

The most likely limit to break things is on queries. Even in a well designed org your triggers might consume an average of two or three queries per transaction. Then they may fire other triggers, etc. Even with static lazy loading you might consume your allotted 100 queries if it cascades too far, but relatively new or well designed systems should still be able to handle it without issue.

In highly complex or poorly designed orgs this number can balloon rapidly. So if your org is already near the tipping point, it would not be surprising for this straw to break the camel's back.

  • Does the trigger runs independently of each record present in csv file? Example for first record trigger runs and for the second record trigger again runs , both the run are independent of each other! – SfdcBat Apr 23 '16 at 3:26
  • 1
    @Rdvsm one batch equals one transaction. – Adrian Larson Apr 23 '16 at 3:27
  • By one batch you mean the complete csv file ? – SfdcBat Apr 23 '16 at 3:28
  • 1
    You batch your uploads... default size is 200. – Adrian Larson Apr 23 '16 at 3:29
  • 1
    100 is the query limit. 150 is for DML limit. – Vigneshwaran G Apr 23 '16 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.