function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JaanuJaanu 

Duplicate Account rules when creating new accounts from External Integration ?

I am trying to integrate Salesforce with 3rd party system to create new accounts. I know within SF, there are duplicate rules and matching rules exist. Before I create new accounts, I want to run thru the existing duplicate rules on Account (Org has Person Accounts Enabled). if there is any duplicate I want to dump those accounts into temporary object for further review... if there is no duplicate, then I want to create new account. Let me know how this can be achieved pls ?

If I can't use dumplicate/matching rules ...then any SOQL/SOSL query example where I can search in the Org to find out any duplicates or not.. 
I am going to verify First Name, Last Name, ZIP/postal code fields for duplicates. 
Raj VakatiRaj Vakati
I got you requirement .. 

You can do it simly with the duplicate rules 
  1. Create a duplicate rules 
  2. When event duplicate reocord is create the data will store in  Duplicate Error Logs and Duplicate Record Sets object 
  3. Write an trigger on Duplicate Record Sets to push the data into custom object or you can retrieve the data from the Duplicate Record Sets it self
JaanuJaanu
Thanks Raj. Just to clarify meself little more ... 

I have a Inbound event object where all the inbound queue will be stored from 3rd party. I have a trigger on this event. After that what are the steps pls ?

1. I can create new duplicate rules in my Org (First Name, Last Name, Zip code etc). How do I access these duplicate rules from the above trigger ?? 
2. If there is no duplicates, then I will create new account.
3. If there is any potential match (even one field or 2 fields etc)... then I have to write into new custom object.. where user can review manually. 

Please give me the code ... thanks.