You need to sign in to do that
Don't have an account?
Yamile Pacheco Cueva
Ignore duplicate result in visualforce page
I have a visualforce page with a standard controller and a an extension that queries a child and grandchild of the standard controller. The grandchild records have a duplicate match rule. However, my visualforce form only updates existing records. Users do not create new records in it. By the time they get to my visualforce page to edit, they have already said "save and ignore" when they first created the record.
What do I have to do to ignore the duplicate rule for the visualforce page? I would need a sample code as I am new to apex.
What do I have to do to ignore the duplicate rule for the visualforce page? I would need a sample code as I am new to apex.
You need to use the DmlOptions.DuplicateRuleHeader https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Database_DMLOptions_DuplicateRuleHeader.htm class. The isAllowSave method is used to determine if a rule allows saving or not (e.g. provide a warning or an error).
The following modification should suffice: Hope this helps.
Thanks,
Nagendra