![]() |
#1 |
Участник
|
Jim Wang: CRM 4.0 Get attribute value from entity's GUID using JScript
Источник: http://jianwang.blogspot.com/2008/12...m-entitys.html
============== Recently I have been asked many times about how to get attribute value from entity's GUID using JScript? The following code demonstrate how to get a user's internalemailaddress by giving user's GUID. *It has been modified to support multi-tenent deployment. alert(GetAttributeValueFromID("systemuser", "09DF2AB7-E16D-DD11-88F3-0003FF884968", "internalemailaddress", "systemuserid")); function GetAttributeValueFromID(sEntityName, sGUID, sAttributeName, sID) { var xml = "" + "" + "" + GenerateAuthenticationHeader() + " " + " " + " " + " "+sEntityName+"" + " " + " " + " "+sAttributeName+"" + " " + " " + " false" + " " + " 1" + " 1" + " " + " " + " And" + " " + " " + " "+sID+"" + " Equal" + " " + " "+sGUID+"" + " " + " " + " " + " " + " " + " " + " " + "" + ""; var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple"); xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlHttpRequest.setRequestHeader("Content-Length", xml.length); xmlHttpRequest.send(xml); // retrieve response and find attribute value var result = xmlHttpRequest.responseXML.selectSingleNode("//q1:" + sAttributeName); if (result == null) return ""; else return result.text; } Источник: http://jianwang.blogspot.com/2008/12...m-entitys.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|