使用CRM 2011 oData服务创建联系人时出现此错误。
var newContact = Object();
newContact.firstname = Xrm.Page.getAttribute("ct_leadconversioncontactfirstname").getValue();
newContact.lastname = Xrm.Page.getAttribute("ct_leadconversioncontactlastname").getValue();
newContact.gendercode = Xrm.Page.getAttribute("ct_leadconversioncontactgender").getValue();
newContact.jobtitle = Xrm.Page.getAttribute("ct_leadconversioncontactjobtitle").getValue();
newContact.websiteurl = Xrm.Page.getAttribute("ct_leadconversioncontactwebsite").getValue();
var jsonContact = window.JSON.stringify(newContact);
$.ajax({
async: false,
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: jsonContact,
url: methodUrl,
beforeSend: function (XMLHttpRequest) {
//ensures the results will be returned as JSON.
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: successCallback,
error: failedCallback
});
答案 0 :(得分:5)
我从错误中猜出你的网址是错误的。
确保methodUrl
参数类似于:
url: <your servuer url> /XRMServices/2011/OrganizationData.svc/ContactSet"
因为看起来请求说“我得到你的发送但你发布到的地方没有对象上的名字属性”
请检查其发布到ContactSet
答案 1 :(得分:0)
它采用相关实体字段中提到的模式名称。