Показать сообщение отдельно
Старый 04.05.2012, 17:53   #6  
Taker1796 is offline
Taker1796
Участник
Аватар для Taker1796
 
112 / 11 (1) +
Регистрация: 22.04.2012
Цитата:
Сообщение от a33ik Посмотреть сообщение
Покажите код, пожалуйста - помогу.
//кнопка
crmForm.all.new_button.DataValue = "Пересчитать кредит";
crmForm.all.new_button.style.textAlign = "center";
crmForm.all.new_button.vAlign = "middle";
//вид кнопки
crmForm.all.new_button.style.cursor = "hand";
crmForm.all.new_button.style.backgroundColor = "#CADFFC";
crmForm.all.new_button.style.color = "#000000";
crmForm.all.new_button.style.borderColor = "#330066";
crmForm.all.new_button.style.fontWeight = "bold";
crmForm.all.new_button.contentEditable = false;
//обработка клика по кнопке
crmForm.all.new_button.attachEvent("onclick",TestTheButton);
function TestTheButton()
{ var guid=crmForm.ObjectId;
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'>"+
GenerateAuthenticationHeader()+
"<soap:Body>"+
"<Retrieve xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+
"<entityName>new_dogovor</entityName>"+
"<id>"+guid+"</id>"+
"<columnSet xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' xsi:type='q1:ColumnSet'>"+
"<q1:Attributes>"+
"<q1:Attribute>new_credit_programm</q1:Attribute>"+
"</q1:Attributes>"+
"</columnSet>"+
"</Retrieve>"+
"</soap:Body>"+
"</soap:Envelope>";

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);

var resultXml = xHReq.responseXML;
var rez=resultXml.selectSingleNode("//q1:new_credit_programm").nodeTypedValue;
alert(rez);