积极答复者
crm 中用JavaScript调用webservice 访问客户实体获取客户的拥有者的信息,也就是获取某一个客户的责任人的信息失败---急求答案

问题
-
crm 中用JavaScript调用webservice 访问客户实体获取客户的拥有者的信息,也就是获取某一个客户的责任人的信息,但是我不能访问account,其代码如下:
var oField ="543A5E72-42C8-4E64-99D6-0000EAAE061A";
var serverUrl = "/mscrmservices/2007/crmservice.asmx";
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST",serverUrl,false);
xmlhttp.setRequestHeader("Content-Type","text/xml; charset=utf-8");
xmlhttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");
var message =
[
"<?xml version='1.0' encoding='utf-8'?>",
"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>",
GenerateAuthenticationHeader(),
"<soap:Body>",
" <Retrieve xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>",
" <entityName>account</entityName>",
" <id>", oField, "</id>",
" <columnSet xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' xsi:type='q1:ColumnSet'>",
" <q1:Attributes>",
" <q1:Attribute>name</q1:Attribute>",
" <q1:Attribute>ownerId</q1:Attribute>",
" <q1:Attribute>owningUser</q1:Attribute>",
" </q1:Attributes>",
" </columnSet>",
" </Retrieve>",
"</soap:Body>",
"</soap:Envelope>"
].join("");
xmlhttp.send(message);
var resultXml = xmlhttp.responseXML;
alert(message);
alert("nodeTypedvalue= "+resultXml.selectSingleNode("//q1:ownerId").nodeTypedValue);
var errorCount = resultXml.selectNodes('//error').length;if (errorCount != 0)
{
var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
alert(msg);
}
else
{
if(resultXml.selectSingleNode("//q1:ownerId").nodeTypedValue!=null)
{
var pID=resultXml.selectSingleNode("//q1:ownerId").text;
var pName=resultXml.selectSingleNode("//q1:ownerId").getAttribute("name");
var pLook=new Array;
//pLook[0] = new LookupControlItem(pID, "8", pName);
alert("pID= "+pID);
alert("pName= "+pName);
}
else
{
//crmForm.all.zz_uomid.DataValue=null;
}
if(resultXml.selectSingleNode("//q1:owningUser").nodeTypedValue!=null)
{
var pID=resultXml.selectSingleNode("//q1:owningUser").text;
var pName=resultXml.selectSingleNode("//q1:owningUser").getAttribute("name");
var pLook=new Array;
//pLook[0] = new LookupControlItem(pID, "8", pName);
alert("pID= "+pID);
alert("pName= "+pName);
}
}- 已编辑 刘祖君(Eric Liu) 2009年8月7日 1:46
答案
-
http://www.cnblogs.com/caims/archive/2008/05/28/1209084.html
Batistuta Cai-刀客 | 蔡敏生 | MS CRM MVP | Blog:http://caims.cnblogs.com- 已标记为答案 Jim Wang (Microsoft)Microsoft employee, Moderator 2009年8月13日 8:20
-
谢谢你的回复!已经找到错误原因了,属性的名称不能为大写,必须为小写
- 已标记为答案 Jim Wang (Microsoft)Microsoft employee, Moderator 2009年8月13日 8:20
全部回复
-
http://www.cnblogs.com/caims/archive/2008/05/28/1209084.html
Batistuta Cai-刀客 | 蔡敏生 | MS CRM MVP | Blog:http://caims.cnblogs.com- 已标记为答案 Jim Wang (Microsoft)Microsoft employee, Moderator 2009年8月13日 8:20
-
谢谢你的回复!已经找到错误原因了,属性的名称不能为大写,必须为小写
- 已标记为答案 Jim Wang (Microsoft)Microsoft employee, Moderator 2009年8月13日 8:20