Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to run the trigger only when the records are inserted through data loader not when records are created through UI or records are created through other trigger.Is there a way to do this

share|improve this question
up vote 3 down vote accepted

You could add a custom checkbox field which is hidden from the pagelayout.

  • This field could be mapped to always insert as "true" with dataloader.
  • Make your after insert trigger only execute conditionally on this field to be true.
  • Optionally have your trigger set the field to false, or you could keep it as true to see that these records were imported through data loader.
share|improve this answer
Great minds ;-) – Adam Michael Daw Jan 28 '14 at 17:35

The way we handled this recently was to set a boolean on the records called "From_Import__c" and only set that to true when loading in from the dataloader (in our case it was through Jitterbit ETL)

share|improve this answer

Through "other trigger" you can do by using a static variable:

public class PreventTrigger {
    public static Boolean forNow = false;

trigger A on A (after insert) {
    PreventTrigger.forNow = true;
    // logic to get to B trigger
    insert b;

trigger B on B (after insert) {
    if(PreventTrigger.forNow) {
    // Rest of logic

For updating "only through the data loader", you need a field that you can specify as hidden to users, but available in the data loader, such as a checkbox field. There's no way accurately to detect if an action came from the UI or from the Data Loader otherwise.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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