Build queries with FetchXML

 

Applies To: Dynamics CRM 2013

FetchXML is a proprietary query language that is used in Microsoft Dynamics CRM 2013 and Microsoft Dynamics CRM Online. It’s based on a schema that describes the capabilities of the language. The FetchXML language supports similar query capabilities as query expressions. In addition, it’s used as a serialized form of query, used to save a query as a user-owned saved view in the userquery entity and as an organization-owned saved view in the savedquery entity.

A FetchXML query can be executed by using the IOrganizationService.RetrieveMultiple method. You can convert a FetchXML query to a query expression with the FetchXmlToQueryExpressionRequest message.

For information about how to use LINQPad to work with FetchXML, see this blog post: Getting FetchXML from LINQPad.

For information about a utility that you can use to convert SQL scripts to FetchXML, see SQL2FetchXML Help.

In This Section

Use FetchXML to construct a query

Use FetchXML aggregation

Page large result sets with FetchXML

Fiscal date query operators in FetchXML

Use a left outer join in FetchXML to query for records "not in"

Sample: Use aggregation in FetchXML

Sample: Use FetchXML with a paging cookie

Sample: Convert queries between Fetch and QueryExpression

Sample: Validate and execute a saved query

Build queries with LINQ (.NET language-integrated query)

Build queries with QueryExpression

Retrieve records for many-to-many relationships using intersect entities

FetchXML schema