Support for duplicate detection in Create
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);
});
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
Simply by going through the Microsoft's compiled JavaScript. We have been in need to modify the duplicate behavior, so found out that way.