i'm trying to Create Case Record using Odata Rest Services.but i'm getting error.
I think problem with lookup field.
function test() {
debugger;
var PostID = Xrm.Page.getAttribute("ism_name").getValue();
var ismaccount = Xrm.Page.getAttribute("ism_account").getValue()[0].name;
//var ismcontact = Xrm.Page.getAttribute("ism_contact").getValue();
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));
}
Could anybody plz help me out
hsk srinivas