When I try to create a duplicate in the CRM web application I am getting a pop-up indicating that I am trying to create a duplicate record. However, if the create using Web API (C#) from a .Net application then by default, the duplicate record is getting created without any warning.
Here is the sample code we are using to using to create a record using Web API
JObject accountRecord = new JObject(); accountRecord.Add("name", "JKC"); accountRecord.Add("accountnumber", "00112233"); HttpRequestMessage createAccountReq = new HttpRequestMessage(HttpMethod.Post, getVersionedWebAPIPath() + "accounts"); createAccountReq.Content = new StringContent(accountRecord.ToString(), Encoding.UTF8, "application/json"); HttpResponseMessage createAccountRes = await httpClient.SendAsync(createAccountReq);
*This post is locked for comments
Hello,
To turn on duplicates validation using webapi you should add new header "MSCRM.SuppressDuplicateDetection" to request with value "false".
That should resolve your ussue.
if you want to avoid duplicates create an alternate key connected to your unique attribute
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156