You need to sign in to do that
Don't have an account?

How to replicate the duplicate management rule in apex class
Hi
In Account object, therre is a duplicate management rule for account name. We override the edit page of account. The problem is when the user try to create a duplicate record it throwing the error like "Update failed. First exception on row 0 with id 001Q0000010c9osIAA; first error: DUPLICATES_DETECTED, You may be creating a duplicate record. If so, we recommend you use the existing record instead.: []
Error is in expression '{!CustomSave}' in component <apex:commandButton> in page customsavepage: Class.CustomControllerSaveofAccount.CustomSave: line 21, column 1".
But i wan to show like this

Can anyone help me out to solve this issue.
In Account object, therre is a duplicate management rule for account name. We override the edit page of account. The problem is when the user try to create a duplicate record it throwing the error like "Update failed. First exception on row 0 with id 001Q0000010c9osIAA; first error: DUPLICATES_DETECTED, You may be creating a duplicate record. If so, we recommend you use the existing record instead.: []
Error is in expression '{!CustomSave}' in component <apex:commandButton> in page customsavepage: Class.CustomControllerSaveofAccount.CustomSave: line 21, column 1".
But i wan to show like this
Can anyone help me out to solve this issue.
You could show those custom messages by handling errors messages and then building custom logic around your save result. Something like below
Look for Datacloud.DuplicateResult and Datacloud.MatchResult salesforce.com documentation and you can get what you needed.