FetchXML Builder – Features

The feature set of FetchXML Builder has grown constantly over the years. But the basic idea of “a tool to easily build and test queries” has never lost focus.

Building queries 🔗

Visual query construction 🔗

Since XML is a hierarchical representation of information, the designer for the FetchXML queries is presented as an outline (a.k.a. treeview) where each node in the designer corresponds to an element in the XML.

Selecting a node in the outline will display the Node Properties panel below the outline.

Quick Actions 🔗

Depending on which node in the query builder that is selected, different sub-nodes are possible to add. Right-click the node or click the Quick Actions to add a sub-node.

CDS/CRM/D365 metadata intellisense 🔗

To assist with the query creation, FetchXML Builder loads metadata from the connected environment as needed. This makes it possible to select from existing entities, attributes, relationships, optionsets etc.

Attribute selection 🔗

Dialog with sorting and filtering

The easiest way to select attributes to include in the query, select the entity or link-entity node for which to specify attributes, and click the Select Attributes shortcut.

One by one with intellisense

It is also possible to add attributes one-by-one, and depending on setting Friendly Names it will show either logicalname or display name of each attribute.

Joining related entities 🔗

Using relationships

To join the query based on an existing relationship, use the drop-down listing existing relationships to populate the Entity name, From and To properties of the link-entity node.

Custom join arguments

FetchXML supports joining on any two attributes of the same type. This means it is possible to join on other attributes than those of direct relationships. In this example contacts are joined with users on the State or Provice field.
For a complete description of this, see Create view: Active Contacts in My State.

Change history 🔗

Undo (CTRL+Z)

Every change to the query is recorded, to enable full Undo functionality. Hoovering over the Undo button will show the last change made, which will be undone.

Redo (CTRL+Y)

When changes have been undone, they can of course also be redone.

Advanced queries 🔗

Aggregate query support 🔗

Not-in queries 🔗

Paged or all pages

Abort query execution

Query management 🔗

Open query 🔗

From View in Dataverse/CRM/D365

Use menu option Open – View to select an entity and a view from the connected environment. Views opened this way can also be saved back to the environment.

From Dynamic Marketing List

Dynamics marketing lists contain a FetchXML defining target records. These can be opened be opened, tested, modified and also be saved back to the environment.

From File

Select menu option Open – File to open a query from XML file on disk.

Save query 🔗

Depending on how the query was opened, different options are available.

Save File

Save the opened file back to disk with the same name.

Save File as…

Enter a new file name and save the query.

Save View

Save the query of the opened system or personal view. Note that FetchXML Builder only saves the query, not the layout definition or any other properties of the view. This means that the attributes included in the query must remain the same as when the query was opened.

Save View as…

This will save the opened view to a new personal view, available only to the current user. Save View as can currently only be performed for personal views.

Back to opened Marketing List

Save the query back to the marketing list from which it was opened.

Clone query to new window 🔗

With same connection

With new connection

Query Repository 🔗

Query rendering formats 🔗

The query being constructed in the visual outline can be transformed into a number of different formats.

All rendered formats are automatically updated as you work with the query, so it is always possible to see how your changes affect the output.

FetchXML 🔗


This is the “normal” view of the generated query – the actual FetchXML that is sent to the backend when executing the queries.


This format contains plain FetchXML, but without line breaks and indentations.


The HTML format can be used when posting FetchXML on web-based platforms.


The escaped format can be used in urls, like the WebAPI endpoint.

Power Automate 🔗

List Records parameters

This representation provides all parameters necessary to get the same results from a List Records action in a Power Automate flow.


Internal (somewhat limited)

FetchXML Builder provides a simple conversion to SQL.

Through the SQL 4 CDS tool

For more complex queries and a nicer editor experience, install the SQL 4 CDS tool which can then be integrated from FetchXML Builder!

C# 🔗

QueryExpression code

This code is a fully functional block of code representing the query. Note that all features are not supported by the QueryExpression class, such as aggregate queries.

FetchXML code

Code that composes a C# string variable with the query. Any condition values are extracted to variables for easier manipulation.

JavaScript 🔗

FetchXML code

Code that composes a javascript variable with the query. Any condition values are extracted to variables for easier manipulation.

OData / WebAPI 🔗

OData v2

The older version of OData endpoint. Url can be executed or copied.

OData v4 / WebAPI

The new version of the OData endpoint, a.k.a. WebAPI. Url can be executed or copied.

Result formats 🔗

View (Excel like table) 🔗

Serialized 🔗


Custom XML formats


Integration from other XrmToolBox tools 🔗

Call FXB with original query (may be empty)

Modified query is returned to caller

Read more: Integrate with FetchXML Builder

Options 🔗

Switch between technical and display names

FetchXML Builder can show either the technical names (logicalname) of entities and attributes, or the “friendly” names (displaynames). Showing friendly names can help if you are not sure about what the entities and attributes are really called behind the scenes, and vice versa.

Single/double quotes in generated FetchXML

When using the generated FetchXML in code of any kind, it may be required to use either double quotes or single quotes. A common scenario is when the FetchXML shall be added as a property to a JSON object, or simply assigned to a variable in C# or JavaScript.

Lookup control to select guid based filter conditions


Select entities to show based on metadata properties


Select attributes to show based on metadata properties


Define custom template for new queries


Fully configurable window layout


4 thoughts on “FetchXML Builder – Features

  1. hi i have a result view i would like to save with headers to excel. the only way how i know off is via copy paste or did i miss something

  2. Hi Jonas,
    I have requirement for which I m struggling to create FetchXml query. Can you please help?

    Requirement: I would like to list down all contacts from application which are not present in a given static marketing list.

  3. Hi Jonas,
    I have a similar requirement to Ravi above. I have written the fetchxml code and it runs successfully in XrmToolBox, however when I save the view back to CRM the filter conditions that I defined in my fetchxml are lost, and the original view in CRM is not updated as desired.

    Is this a known issue and are there any limitations with saving views back to CRM?

    Note: in my case, I am using a to create an outer join and I also have a element that is a sibling of the link-entity and NOT contained within it. And it is this sibling that does not get saved back to the CRM system.

    Code is below:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.