DRB icon indicating copy to clipboard operation
DRB copied to clipboard

Support for duplicate detection in Create

Open hajekj opened this issue 3 years ago • 2 comments

Xrm.WebApi.online.execute supports passing property suppressDupeDetection which enables duplicate detection. It is not documented, but works. Would you be interested in adding this to the DRB?

var record = {};
record.name = "T"; // Text var createRequest = {
    etn: "account",
    payload: record,
    suppressDupeDetection: false,
    getMetadata: function () { return { boundParameter: null, parameterTypes: {}, operationType: 2, operationName: "Create" }; }
}; Xrm.WebApi.online.execute(createRequest).then(
    function success(response) {
        if (response.ok) {
            console.log("Record created");
        }
    }
).catch(function (error) {
    console.log(error.message);
});

hajekj avatar Jan 13 '23 10:01 hajekj

It should be the equivalent of the MSCRM.SuppressDuplicateDetection header but as you wrote is not documented. The MSCRM.SuppressDuplicateDetection is already added for the other syntaxes (Fetch, jQuery, XHR) by making the Detect Duplicates option to Yes. What I can eventually do is to modify the comment // WARNING: Xrm.WebApi doesn't support Detect Duplicates to indicate that suppressDupeDetection can be used but because is not documented I am not inclined to add it. Can you let me know where you found this option? also by DM. Thanks

GuidoPreite avatar Jan 13 '23 10:01 GuidoPreite

Simply by going through the Microsoft's compiled JavaScript. We have been in need to modify the duplicate behavior, so found out that way.

hajekj avatar Jan 18 '23 13:01 hajekj