There is this incredibly frustrating bug concerning a conflict between the Process Builder and Duplicate Management.
Some people have suggested a workaround for it, but I can't get it to work, the conflict is still happening for me.
This is the workaround, thanks goes to Yi-Hs Tsai and Manu Devaraju:
For those looking for a work around to this very annoying problem, here's a solution that I've found works:
Create a checkbox field on the object called "Allow duplicates?" with default set to false.
In your Duplicate rule definition, include this new field under the "Conditions" section.
In your flow or process builder, BEFORE you update the record, first do an update where you set the "Allow duplicates?" field to true. Then perform the update you want.
Since "Allow duplicates?" is checked and the update no longer meets the rule conditions, so shouldn't trigger the duplicate rule.
If you want the duplicate rule to run in the future for this record, you can do another record update to uncheck the "Allow duplicates?" field.
For instance, I have a duplicate rule on Contacts that has a whole bunch of matching criteria. Following the steps I:
Create a field on the Contact object called "Allow Duplicates?" with default unchecked.
In my duplicate rule (Setup -> quickfind -> Duplicate Rules), I set a condition: "Contact: Allow Duplicates? EQUALS False"
In my flow, I have a step where I set Allow Duplicates? = true and update my record.
In my flow, then I perform the update on the email, phone, etc., that ordinarily would trigger the rule because of the my matching criteria.
In my flow, when I'm all done, I set the Allow Duplicates? back to false.
Someone else (Daniel DeAguilar) had some more on this:
So what i did was created the allow duplicates checkbox Yi-Hs mentions on my Account object (default unchecked), and in process builder did the following steps:
Under 'Choose Object and Specify When to Start the Process' i had recursion enabled (this was key)
1st node in process was looking for whenever my parent account field was changed
Immediate action in 1st node was changing duplicate checkbox to 'checked/true'
instead of stop i had 'evaluate next criteria' and go to 2nd node'
2nd node looked for when duplicate checkbox = true/checked
immediate action #1 to set parent account lookup to parent account id field (enabling lookup related lists)
immediate action #2 to set duplicate checkbox = false/unchecked
In the debug log I can see that the process is being run and after that the duplicate detection runs and everything is OK, the new custom field has the proper value and detection is prevented.
But after that more processing goes on and duplicate detection runs once more and this time the new custom field has its default value, so it doesn't prevent detection and you get the DUPLICATES_DETECTED error that the process cannot handle.
Most mystifying for me is where/how exactly the 'Allow duplicates' field must be updated. The process builder does not have an explicit Update command/option.
Here's a screenshot of my process builder configuration: