товарищи!
Добрый день!
Подскажите, пожалуйста, как получить имя объекта в лукапе..
подробнее - есть сущность
opportunity, на ней есть лукап
new_projectid
запрос получает несколько сущностей
opportunity и соответствующие
new_projectid.
projectnameValue.nodeTypedValue дает id соответствующего проекта, а имя достать не получается.
в XMLresponse оно есть, но достать не получается (пробовал по всякому)
X++:
function opportunity()
{
var authenticationHeader = GenerateAuthenticationHeader();
// Prepare the SOAP message.
var xml = "<?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'>"+
authenticationHeader+
"<soap:Body>"+
"<RetrieveMultiple xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+
"<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query'"+
" xsi:type='q1:QueryExpression'>"+
"<q1:EntityName>opportunity</q1:EntityName>"+
"<q1:ColumnSet xsi:type='q1:ColumnSet'>"+
"<q1:Attributes>"+
"<q1:Attribute>opportunityid</q1:Attribute>"+
"<q1:Attribute>new_projectid</q1:Attribute>"+
//"<q1:Attribute>new_object</q1:Attribute>"+
"</q1:Attributes>"+
"</q1:ColumnSet>"+
"<q1:Distinct>false</q1:Distinct>"+
"</query>"+
"</RetrieveMultiple>"+
"</soap:Body>"+
"</soap:Envelope>";
// Prepare the xmlHttpObject and send the request.
var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xHReq.setRequestHeader("Content-Length", xml.length);
xHReq.send(xml);
// Capture the result.
var resultXml = xHReq.responseXML;
// Check for errors.
var errorCount = resultXml.selectNodes('//error').length;
if (errorCount != 0)
{
var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
alert(msg + 'we');
}
// Parse and display the results.
else
{
var results = resultXml.getElementsByTagName('BusinessEntity');
var msg = "";
if (results.length == 0)
{
msg = "No id were found in .";
alert(msg);
return;
}
else
{
for (i=0;i < 10;i++)
{
var idValue = results[i].selectSingleNode('./q1:opportunityid').nodeTypedValue;
var projectnameValue = results[i].selectSingleNode('./q1:new_projectid');
if (projectnameValue != null)
{
alert(idValue + projectnameValue.nodeTypedValue);
}
}
}
}
}