Показать сообщение отдельно
Старый 23.09.2009, 16:06   #31  
Skyway is offline
Skyway
Участник
 
78 / 10 (1) +
Регистрация: 07.08.2009
<Entity name="new_business_trip">
<!-- The Account Tool Bar -->
<Grid>
<MenuBar>
<ActionsMenu>
<MenuItem WinMode="1">
<Titles>
<Title LCID="1033" Text="тест1" />
</Titles>
</MenuItem>
</ActionsMenu>
<Buttons>
<Button Icon="/_imgs/ico_18_debug.gif" JavaScript=
"function GetAttributeValueFromID(sEntityName, GUID, sAttributeName)
{
var authenticationHeader = GenerateAuthenticationHeader();
// Prepare the SOAP message.
var xml = '';
xml = xml+'<?xml version=&apos;1.0&apos; encoding=&apos;utf-8&apos;?>'+
'<soap:Envelope xmlns:soap=&apos;http://schemas.xmlsoap.org/soap/envelope/&apos;'+
' xmlns:xsi=&apos;http://www.w3.org/2001/XMLSchema-instance&apos;'+
' xmlns:xsd=&apos;http://www.w3.org/2001/XMLSchema&apos;>'+
authenticationHeader+
'<soap:Body>'+
'<Retrieve xmlns=&apos;http://schemas.microsoft.com/crm/200...os;>'+
'<entityName>'+sEntityName+'</entityName>'+
'<id>'+GUID+'</id>'+
'<columnSet xmlns:q1=&apos;http://schemas.microsoft.com/crm/2006/Query&apos; xsi:type=&apos;q1:ColumnSet&apos;>'+
'<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 result1 = resultXml.selectNodes('//q1:' + sAttributeName).length;
if (result1 != 0)
{
var result = resultXml.selectSingleNode('//q1:' + sAttributeName).nodeTypedValue;

if (errorCount != 0)
{
var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
result = ' ';
//alert(msg);
}
// Display the retrieved value.
else
{
return result;
}
}
}

var a = '{07BAE349-C55B-DE11-A2A2-000E0C4BF7BF}';
My_select= GetAttributeValueFromID('account',a,'address1_city');
alert(My_select);" PassParams="0" WinParams="" WinMode="0">
<Titles>
<Title LCID="1049" Text="Экспортировать" />
</Titles>