1

I have a javascript which uses OData and Creates a record in PhoneCall entity. I have Subject attribute of this PhoneCall entity which need to be unique. I read about "SuppressDuplicateDetection" parameter in following link - https://msdn.microsoft.com/en-us/library/hh210213.aspx

How can I leverage this parameter inside my OData call?

Here's my javascript code -

var serverUrl = Xrm.Page.context.getServerUrl() + '/XRMServices/2011/OrganiationData.svc/PhoneCallSet'
$.ajax
({
    type:"POST",
    contentType: "application/json; charset=utf-8",
    datatype: "json",
    url: serverUrl,
    data: phoneCallData,
    beforeSend: function(xhr)
    {
        xhr.setRequestHeader("Accept", "application/json");
    },
    success: function (data, textSTatus, XmlHttpRequest)
    {
        //my success LOC
    },
    error: function (xmlHttpRequest, textSTatus, errorThrown)
    {
        //error handler
    },
    async: false
});
Avdhut Vaidya
  • 314
  • 2
  • 13

1 Answers1

0

Really sad to say this: No way to use SuppressDuplicateDetection option with odata on client side.

we need the CreateRequest to enable Dup detection while creating record and therefore this feature is not available when creating records using oData.

Ref: https://community.dynamics.com/crm/b/crminogic/archive/2014/07/21/duplicate-detection-is-back-in-microsoft-dynamics-crm-spring-release

  • 1
    What I did was - create a new field for this entity Then, I went on to create a Unique Index over this newly created field in the Database. I put a Null Qualifier for the Index to apply From my javascript, I populate the value for this field with a value which I consider to be unique. So, in case for any reason of concurrency, this call gets called twice, the database will prevent duplicate entry of record. it wrks! – Avdhut Vaidya Sep 05 '17 at 08:04