Answered by:
CRM 4.0 : Any good examples of FetchXML in JavaScript.

Question
-
Hey Guys,
Any good examples of FetchXML in JavaScript containing 1 LinkEntity?
Thanks.
- Changed type Andrii ButenkoMVP, Moderator Monday, November 21, 2011 12:15 PM
Monday, November 21, 2011 11:52 AM
Answers
-
give this a go buddy
http://techdetector.wordpress.com/2010/10/07/fetch-xml-and-javascript-in-crm-4-0/
I hope this helps.
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com- Proposed as answer by Amreek Singh Monday, November 21, 2011 12:21 PM
- Marked as answer by _Hopeful Tuesday, November 22, 2011 6:23 PM
Monday, November 21, 2011 12:21 PM -
Hello,
Following sample illustrates how to use 2 link entities - http://jianwang.blogspot.com/2008/01/crm-40-check-current-users-security.html
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Marked as answer by _Hopeful Tuesday, November 22, 2011 6:21 PM
Monday, November 21, 2011 12:48 PMModerator
All replies
-
give this a go buddy
http://techdetector.wordpress.com/2010/10/07/fetch-xml-and-javascript-in-crm-4-0/
I hope this helps.
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com- Proposed as answer by Amreek Singh Monday, November 21, 2011 12:21 PM
- Marked as answer by _Hopeful Tuesday, November 22, 2011 6:23 PM
Monday, November 21, 2011 12:21 PM -
Hello,
Following sample illustrates how to use 2 link entities - http://jianwang.blogspot.com/2008/01/crm-40-check-current-users-security.html
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Marked as answer by _Hopeful Tuesday, November 22, 2011 6:21 PM
Monday, November 21, 2011 12:48 PMModerator -
where is line 23 function..
Xml += _HtmlEncode(fetchXml);
?If it helps, Mark as answer to help others..else it's scrap
Tuesday, November 20, 2012 10:04 AM -
good to link entities but no fetch xml
If it helps, Mark as answer to help others..else it's scrap
Tuesday, November 20, 2012 10:06 AM -
I wrote somthing for myself.. sharing here
// Fetch XML Query var fetch3 = "<fetch mapping='logical'><entity name='"; fetch3 += entity_name; fetch3 += "'><all-attributes/><filter type='and'><condition attribute='"; fetch3 += attrib1_name; fetch3 += "' operator='eq' value='"; fetch3 += value_1; fetch3 += "'/><condition attribute='"; fetch3 += attrib2_name; fetch3 += "' operator='eq' value='"; fetch3 += value_2; fetch3 += "'/></filter></entity></fetch>"; // SOAP Envelop var soap2 = "<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\">" soap2 += GenerateAuthenticationHeader() soap2 += "<soap:Body>"; soap2 += "<Fetch xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">"; soap2 += "<fetchXml>"; soap2 += fetch3; soap2 += "</fetchXml>"; soap2 += "</Fetch>"; soap2 += "</soap:Body>"; soap2 += "</soap:Envelope>"; // XmlHttp Request var XmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); XmlHttp.open("POST", 'http://<servername>:<port_no>/MSCrmServices/2007/CrmService.asmx', false); XmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); XmlHttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Fetch"); XmlHttp.send(soap2); var resultDoc = loadXmlDocument(XmlHttp.responseXML.text);
It's working..
If it helps, Mark as answer to help others..else it's scrap
Tuesday, November 20, 2012 11:55 AM