0

I am creating a Visualforce page that will override the Contact New and Edit pages.

I know that when a duplicate (based on Email or SSN) Contact is saved from the standard Contact page, the user has an option to Save (Ignore Alert).

enter image description here

How would I be able to duplicate that behavior on my overridden page?

Right now I get this error and haven't found a way to duplicate the behavior of the standard page to allow saving of the 'duplicate': enter image description here

1

Create an Apex controller for your page and set DML options for insert:

Database.DMLOptions optionsForInsert = new Database.DMLOptions();
optionsForInsert.DuplicateRuleHeader.AllowSave = true;

List<Database.SaveResult> ans = Database.insert(toInsertList, optionsForInsert);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.