Hello All,
I am trying to delete the records using REST End point, but records are not getting deleted and did not get any error message as well. Below is the code.
function DeleteopenCalls()
{
var ODataUrl = "https://XXX.crm5.dynamics.com/XRMServices/2011/OrganizationData.svc/new_callSet?$filter=new_StatusofCall/Value eq 100000000";
var CycleStatus = Xrm.Page.data.entity.attributes.get("new_statusofCam");
var Status_Text = CycleStatus.getText();
if( Status_Text== "Completed")
{
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: ODataUrl,
beforeSend: function (XMLHttpRequest)
{
XMLHttpRequest.setRequestHeader("Accept", "application/json");
XMLHttpRequest.setRequestHeader("X-HTTP-Method", "DELETE");
},
success: function (data, textStatus, XmlHttpRequest)
{
console.log("Success");
alert("Records deleted");
},
error: function (XmlHttpRequest, textStatus, errorObject)
{
console.warn("Request FAILED: " + XmlHttpRequest.responseText);
}
});
}
}
Please let me know where is the issue/problem.
Regards,
Kumar R