Показать сообщение отдельно
Старый 01.04.2009, 07:55   #21  
vital.mih is offline
vital.mih
Участник
 
114 / 10 (1) +
Регистрация: 25.02.2009
Адрес: Пермь
Код:
var invite4 =  GetAttributeValueFromID('new_date_protocol', crmForm.all.new_protocolsfordate.DataValue[0].id, 'new_invite4');

crmForm.all.new_invite.DataValue=invite4



function GetAttributeValueFromID(sEntityName, GUID, sAttributeName)
{
var authenticationHeader = GenerateAuthenticationHeader();
// Prepare the SOAP message.
var xml = "";
xml = 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>"+ 
"<Retrieve xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ 
"<entityName>"+sEntityName+"</entityName>"+ 
"<id>"+GUID+"</id>"+ 
"<columnSet xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' xsi:type='q1:ColumnSet'>"+ 
"<q1:Attributes>"+ 
"<q1:Attribute>"+sAttributeName+"</q1:Attribute>"+ 
"</q1:Attributes>"+ 
"</columnSet>"+ 
"</Retrieve>"+ 
"</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/Retrieve");
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;

var result = resultXml.selectSingleNode("//q1:" + sAttributeName).nodeTypedValue;

if (errorCount != 0)
{
 var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
result = " ";
}
// Display the retrieved value.
else 
{
alert('test')
return result;
}
}
Сначала показывает test, а затем нижеописанное сообщение

Последний раз редактировалось vital.mih; 01.04.2009 в 07:59.