【发布时间】:2014-08-07 09:56:36
【问题描述】:
我在 CustomEntity 上有功能区按钮。 CustomEntity 有一个文本字段和帐户查找基于我正在创建案例记录的字段。但记录没有创造。有人可以帮我吗?我在哪里做错了。以下是我的示例
function test() {
debugger;
var PostID = Xrm.Page.getAttribute("ism_name").getValue();
var ismaccount = Xrm.Page.getAttribute("ism_account").getValue()[0].name;
var serverUrl = document.location.protocol + "//" + document.location.host;
var incident = {};
incident.Title = PostID;
incident.CustomerId = ismaccount;
var jsonEntity = window.JSON.stringify(incident);
//incident.Description = "Dynamicallty created record using REST Odata";
var oDataPath = serverUrl + "/Retail/XRMServices/2011/OrganizationData.svc";
var retrieveReq = new XMLHttpRequest();
var Odata = oDataPath + "/IncidentSet";
retrieveReq.open("POST", Odata, true);
retrieveReq.setRequestHeader("Accept", "application/json");
retrieveReq.setRequestHeader("Content-Type", "application/json;charset=utf-8");
retrieveReq.setRequestHeader("X-HTTP-Method", "CREATE");
retrieveReq.send(JSON.stringify(jsonEntity));
}
【问题讨论】:
标签: javascript rest dynamics-crm-2011 odata dynamics-crm