+ Start a Discussion

How can I implement "Allow" for duplicate record insertion with a controller extension?

I set up a duplicate record rule that says Allow duplicate records.  I have a custom controller extension that calls the Standard Controller as follows when the user hits the Save button:
PageReference pRef = baseController.save();
return pRef;
The pRef is "null" when the record I'm trying to save is a duplicate, according to my rule.  When the page is displayed the error says "Error: There is already a contact in this account with the same email. But you may create this new one anyway."  (This is my text for the duplicate alert message).

But every time baseController.save() gets called it returns this error.  How can I implement the functionality that the second time you click Save it will create the new record anyway?
Hi Dwrigho1,
  In duplicat managent deactive your duplication record rule.