LightningFlowComponents icon indicating copy to clipboard operation
LightningFlowComponents copied to clipboard

*CheckValidation* - DuplicateRuleHeader

Open cadillacben opened this issue 2 years ago • 2 comments

The check for duplicates works if set to true, but if set to false the code seems to be defaulting to allowSave=false making duplicate rules still fire even if you ask it not to. I'm running v1.5 but 1.6 looks the same.

Steps to reproduce

Steps to reproduce the behavior:

  1. create a duplicate rule
  2. set check duplicate rules to false
  3. intentionally insert a duplicate
  4. See error

Expected behaviour

If the check for duplicates is set to false, the duplicate rule should not fire.

Actual behaviour

The duplicate rule fires.

Line 220 (or near there) below seems to be setting the dml.DuplicateRuleHeader.allowSave to false, or maybe it's not set at all. Database.SaveResult[] srListInsert = Database.insert(insertCollection, false);

I updated the line to switch from false to dml (the input value) which seems to have resolved the issue. Database.SaveResult[] srListInsert = Database.insert(insertCollection, dml);

The same seems to apply to updates where switching to this seems to help.

Database.SaveResult[] srListUpdate = Database.update(updateCollection, dml);

cadillacben avatar Jun 30 '22 21:06 cadillacben

I tried and was unable to reproduce this behavior.

ericrsmith35 avatar Jul 04 '22 21:07 ericrsmith35

@cadillacben , can you provide a login to an org that's demonstrating this behavior?

alexed1 avatar Jul 17 '22 03:07 alexed1