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

How to get possibility duplicate records in Apex class or Api
Hi,

As shown in the image i need to get the possible duplicate records when i am inserting record from apex class or Api.
when i am executing from apex class with the following code
Account ll = new lead();
ll.Name = 'Burlington Textiles Corp of America';
insert ll;
it showing error without possibilities like this

Please help on this.
As shown in the image i need to get the possible duplicate records when i am inserting record from apex class or Api.
when i am executing from apex class with the following code
Account ll = new lead();
ll.Name = 'Burlington Textiles Corp of America';
insert ll;
it showing error without possibilities like this
Please help on this.
Can you try this below code in your apex class or custom service class(REST or SOAP)
All Answers
What you will want to do is first to do a search for existing records that match for the Name of the new Account you're trying to create. Exactly what you put in your search would depend on your validation rule. You may also want to use some criteria to return results that although aren't an exact match, have a very similar name.
For example you might have something like.
Account ll = new lead();
ll.Name = 'Burlington Textiles Corp of America';
Then do a search so:
List<Account> possibleDuplicateAccounts = [Select Id, Name from Account WHERE Name like ('%' + ll.Name + '%')];
But i am looking to get the Possibilities from salesforce Data.com - Duplicate Management.
please refer the below Url's
https://help.salesforce.com/apex/HTViewHelpDoc?id=duplicate_prevention_map_of_concepts.htm&language=en_US
http://blog.sonomapartners.com/2015/01/duplicate-management-and-salesforce-spring-15.html
Can you try this below code in your apex class or custom service class(REST or SOAP)
It is working...
Am also facing the same problem for update proces. I overrride the edit page of account uisng an apex class. I tried the RAM Anisetti code. Its throwing an error like "Invalid conversion from runtime type Database.Error to Database.DuplicateError
Error is in expression '{!CustomSave}' in component <apex:commandButton> in page customsavepage: Class.CustomControllerSaveofAccount.CustomSave: line 34, column 1". If you faced the same issue can you please help me how to rectify this.
Could u plz provide the sample code
I am also facing the same situation , could you please send me the code to my email id
hanu.akki@gmail.com
----its very urgent requirement