5

When creating new accounts by posting to /services/data/v36.0/sobjects/Account/ I'm getting DUPLICATES_DETECTED where there are no duplicates.

When posting this JSON, this account is created

{"Billing_huisnr__c":"1", "Name":"Company A A", "Shipping_huisnr__c":"3", 
"Phone":"123123123", "BillingCity":"Stad", "BillingPostalCode":"1000AA",  
 "ShippingStreet":"Straat", "ShippingCity":"Stad", "BillingStreet":"Straat", 
"ShippingPostalCode":"1000AA"}`

Next, when posting this JSON, the account is not created.The difference isn't big, but the name is different.

{"Billing_huisnr__c":"1", "Name":"Company A B", "Shipping_huisnr__c":"3",     
"Phone":"123123123", "BillingCity":"Stad", "BillingPostalCode":"1000AA", 
"ShippingStreet":"Straat", "ShippingCity":"Stad", "BillingStreet":"Straat", 
"ShippingPostalCode":"1000AA"}`

I'm getting this error:

[ {
  "message" : "Een klant met deze naam bestaat al!",
  "errorCode" : "DUPLICATES_DETECTED",
  "fields" : [ ]
} ]

If I try to create the second customer in the Salesforce UI, it works without any errors.

Anyone can offer me some insight? Why can't I create an account via API that can be created via the UI?

Thanks in advance, Rob.

1
  • 1
    did you check if there are any matching rules or duplicate rules that is blocking you from creating the record?
    – cartman
    May 10, 2016 at 17:51

2 Answers 2

2

Yeah, that turned out to be the problem. There was a duplicate rule that matches company names like "Company A" and "Company B". It's not an exact match, which is what caused the problems.

I've replaced that fuzzy matching rule with an exact matching rule and the problems went away.

0

Create new custom REST API for account creation and use DML option to bypass Duplicate rule

Database.DMLOptions dml = new Database.DMLOptions(); dml.DuplicateRuleHeader.allowSave = true; //Controlls bypass dml.DuplicateRuleHeader.runAsCurrentUser = true;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .