Wednesday, July 4, 2018

Late night questions: Will duplicate rules be enforced even if the data load happens via the data loader?

While playing with Matching and Duplicate rules in Salesforce, I got a question on what the behavior would be if a record matching existing data was uploaded through the dataloader. The duplicate matching rules should kick-in but I had to try it out to see if for myself.

As with most doubts in Salesforce, this one could be easily tested using a developer sandbox.

Test Setup:

  1. Create and activate a contact matching rule to match contacts exactly on email and fuzzily (is that a valid word?) on the first name
  2. Create and activate a Duplicate matching rule to block creation of the duplicates. 
  3. Create a sample contact record using the default SFDC UI
  4. Download the record through SFDC Dataloader to serve as a CSV upload template
  5. Edit the downloaded file and remove the Id column. Change the first name to be close the initial value (say Rose to Rosey)
  6. Try to upload this file through the data loader

Data loader outputs an error to the error log:

"LASTNAME","FIRSTNAME","MAILINGSTREET","EMAIL","ERROR"

"Test","Rosey","123 Main St","testemail@qqqqqqqqqqqq.com","Use one of these records?"

Use one of these records?
This is the default message configured on the Duplicate Matching rule. This clearly shows Duplicate rules are being enforced even when the dataloader is used to insert data

Interestingly, this behavior was the same even if the duplicate rule was set to Action On Create = Allow - you still get an error and the Contact is not created. This is different from what the SFDC UI would do - it would allow contact creation.

Tested on Summer '18 Patch 11.4