I am going to load data using WorkBench/Dataloader using UPSERT (ExternalId__c) DML operation.

Once this ExternalId__c is matched then we have to check one more thing like Sr_number__c in that existing record, if sr_number__c is different than the data is coming from the csv file then we have to create new record and if sr_number__c is matched then we have to update that existing matched record.

I have written apex trigger for checking this above condition but when sr_number__c does not match then new record created(this is ok) but during that insertion my old/existing record also getting updated not sure why (may be this record is updating because workbench/dataloader performing upsert call).

please help to handle this case.

1 Answer 1


By the time your trigger is called, Salesforce has already matched (or not) the record based on the External Id. Your trigger can't affect this behavior other than to return an error, which would roll back the transaction. Instead, you're going to need a composite External ID field, and merge the values together as part of your import process.

  • yeah, that make sense !! even i thought the same and implemented that way.. :) Thank you. Oct 30, 2018 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .