在 CRM 2011 中加载我的一个表单时,我正在使用 ajax 帖子来清除一些字段。在大多数记录上它都很好,但在一个记录上它每次都失败,我无法弄清楚这个会导致它失败的不同之处。有人可以查看我正在拨打的电话,看看是否有任何错误?
谢谢
var serverUrl = Xrm.Page.context.getClientUrl().toString();
var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
var crmEntity = new Object();
var ODATA_EntityCollection = "/SalesOrderSet";
crmEntity.ts_payment_data = null;
crmEntity.ts_payment_split = null;
var jsonEntity = window.JSON.stringify(crmEntity);
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
datatype: "json",
async: true,
url: serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection + "(guid'" + orderid + "')",
data: jsonEntity,
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
XMLHttpRequest.setRequestHeader("X-HTTP-Method", "MERGE");
},
error: function (xmlHttpRequest, textStatus, errorThrown) {
alert("ClearPaymentData\nStatus: " + textStatus + "; ErrorThrown: " + errorThrown + "; Response: " + xmlHttpRequest.responseText);
}
});