Build queries with FetchXML
Applies to Dynamics 365 for Customer Engagement apps version 9.x
FetchXML is a proprietary query language that is used in Dynamics 365 for Customer Engagement. 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.
Execute queries in code
A FetchXML query can be executed by using either the Web API or the Organization service.
You can pass a URL encoded FetchXML string to the appropriate entityset using the
fetchXml query string parameter. More information: Use custom FetchXML.
You can convert a FetchXML query to a query expression with the FetchXmlToQueryExpressionRequest message.
The XrmToolBox FetchXML Builder provides a user interface to compose and execute FetchXML queries. Please see the Developer tools topic for community developed tools and fxb.xrmtoolbox.com for more information about FetchXML Builder.
The XrmToolBox FetchXML Builder is not a product of Microsoft Dynamics and does not extend support to it. If you have questions pertaining to the FetchXML Builder, please contact the publisher. More information: XrmToolBox.
Advanced Find includes the capability to download the FetchXML for the query using the Download FetchXML command. More information: Create, edit, or save an Advanced Find search
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 Query Expression
Sample: Validate and execute a saved query
Send feedback about: