Fetch XML is a really handy way of retrieving data from CRM. It is easy to construct complex query and really simple to execute. In this blog article I will explain how you can execute fetch XML query in Dynamic CRM 2011 or CRM online. To start you will first need to download a fetch xml from advanced find and then use the RetrieveMultiple method of the CRM Service to execute the Fetch XML.
First go to Advanced d find and select the entity on which you need to make query
Following is the fetchxml retrieve from Advance Find:
String fetchXml = @"
All now that is left is to send a fetch request. This can simply be done by using the following code.
EntityCollection EC = _service.RetrieveMultiple(
&& EC.Entities !=
&& EC.Entities.Count >= 1)
Guid entityId = E.Id;
Above code shows how RetrieveMultiple method is used to retrieve EntityCollection from fetchxml.
Hope this helps. Happy Coding !!