I have created a matching rule based on a group of three fields;

(Campsite: f1EXACTMatchBlank = TRUE) AND 
(Campsite: f2EXACTMatchBlank = TRUE) AND 
(Campsite: f3EXACTMatchBlank = TRUE)

Here F1,F2 and F3 are the three fields on object Campsite.

I have used the same and created a Duplicate Rule with blocking edit and create if duplicate is already present.

The duplicate rule works fine in all case whether created/update through UI or dataloader; except when I insert a pair of identical new records using data loader.

i.e. two records with same value for F1,F2,F3 but similar record is not present in system yet.

In this case it is inserting both the records.

Is it the correct behavior of duplicate management? Is there any document referring to this behavior?

If it is the correct behavior then can anyone tell me how should I handle this?

Note: I have one more duplicate rule on the same object to validate duplicate names as well.

1 Answer 1


This looks like documented behaviour, indeed:

If you’re saving multiple records at the same time and your duplicate rules are set to Block or Alert, records within the same save aren’t compared to each other; they are only compared with records already in Salesforce.


I guess the duplicate management as it currently is is more oriented towards GUI-based actions and feedback. If you really need to be sure that no duplicates exist on database level, you should better revert to an alternative method:

  1. create a new textfield 'UniqueId' and create a workflow rule that updates that field with a concatenation of the fields that should be unique (in your case e.g. F1 & "-" & F2 & "-" & F3) or
  2. create an apex trigger (after insert/update) that queries the complete table and checks for any duplicates
  • Thanks for providing the link. I will try these approaches and let you know. Commented Apr 22, 2016 at 9:05
  • However I am thinking of creating duplicate rule and keeping a before insert-update trigger to check duplicate in current chunk of records. How does this approach sound? And the confusing point is I have two such rules on the same object. Commented Apr 22, 2016 at 9:08
  • 2
    @SaumyaRanjanSatapathy - I'd really only have either the before insert trigger or the duplicate rule as it would be confusing if anyone needs to remove this check and has it coming in 2 places. Its true that duplicate management is focused on GUI actions not the API updates of data which is a limitation, but I suspect is necessary for performance reasons.
    – Dave Humm
    Commented Apr 22, 2016 at 9:22
  • @DaveHumm yes. Even I feel it will become very confusing for someone maintaining this application at a later point of time. But why salesforce is not providing that out of the box :( Now I am thinking of creating only duplicate rules as client is not using data loader for this table, and making client aware of not using data loader for this object. Commented Apr 22, 2016 at 9:37
  • Hey @Guy, Is there a way that I could customize the error message for your first approach? Commented Apr 22, 2016 at 9:41

You must log in to answer this question.

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