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

Duplicate_Detected Error while inserting the contacts in salesforce
Hi I am pulling data from an external source via a webservice callout. My Contacts are duplicate but i am filtering out duplicate contacts using email before the DML operation, but i am still getting below error
"00:01:06:426 EXCEPTION_THROWN [331]|System.DmlException: Insert failed. First exception on row 2755; first error: DUPLICATES_DETECTED, You're creating a duplicate record. We recommend you use an existing record instead.: []"
Can someone please help how do i get rid of this issue?
"00:01:06:426 EXCEPTION_THROWN [331]|System.DmlException: Insert failed. First exception on row 2755; first error: DUPLICATES_DETECTED, You're creating a duplicate record. We recommend you use an existing record instead.: []"
Can someone please help how do i get rid of this issue?
Can you please check your duplicate rule and let us know on which fields it is being configured. Is it only being configured on Email?
Another question - How are you filtering the duplicate contacts before performing DML? Are you checking the records against the records which are already present in DB? Or are you just filtering the list that you are inserting in your code?
If you have the requirement of always skipping the duplicate rule when you are doing the insertion by pulling the data from external source, then you can make use of below code:
All Answers
Can you please check your duplicate rule and let us know on which fields it is being configured. Is it only being configured on Email?
Another question - How are you filtering the duplicate contacts before performing DML? Are you checking the records against the records which are already present in DB? Or are you just filtering the list that you are inserting in your code?
If you have the requirement of always skipping the duplicate rule when you are doing the insertion by pulling the data from external source, then you can make use of below code:
Below is my duplicate rule detail. I am not sure how do we check what field it is on.
For your second question, I am checking database for already available contacts based on email and if only it is not there then only i am creating my list of records that I need to insert. Even after creating this List, i am sorting it and filtering it to make sure there are no records with same email addresses, my list do not have any duplicate email address records.