Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

How to avoid duplicates when creating records using Web API (C#) ?

$
0
0

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);



Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>