0

I have created a CSV file for Data Loader which contains 8 rows of valid data(for Contact object) and in 9th row i have given Spaces and saved it.

At the same time, i have a trigger on contact which will fires on the insertion of a contact (My Trigger handles batch contacts too). The problem i'm facing is, when i insert the records through data loader, my trigger is running twice(in same debug log).

Any reason for this behavior?

enter image description here

  • Is there any Workflow Field update on Contact object? It is because, If the record was updated with workflow field updates, fires before update triggers and after update triggers one more time (and only one more time). – Devendra Jul 19 '16 at 15:43
  • What's your batch size in the data loader? The second run has different IDs, so it's not processing the same records again. Maybe it's similar to: help.salesforce.com/apex/HTViewSolution?id=000003793 – Nick Cook Jul 19 '16 at 15:46
2

Here are couple of reasons that could be resulting this behavior:

  1. There could be some active workflow rule(s) on contact which are having field updates. A field update will cause triggers to run multiple times. You can refer this link to know more.

  2. Open data loader setting to notice first setting parameter named batch size. Records would be divided into records of batch size and trigger would be called for each batch. So there would be multiple trigger excution logs in debug logs.

| improve this answer | |
  • #Nick #DevendarThanks for your responses. I have no Workflows on Contact object and Batch Size is set to 200. Important note here is, the trigger is running once/fine if data loader has valid data(after removing Spaces). Any Ideas on this? – Rv1 Jul 20 '16 at 11:08

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.