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 🔗
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 🔗
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.
When changes have been undone, they can of course also be redone.
Query management 🔗
Open query 🔗
From View in CDS/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.
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 the opened file back to disk with the same name.
Save File as…
Enter a new file name and save the query.
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.
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!
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.
Code that composes a C# string variable with the query. Any condition values are extracted to variables for easier manipulation.
OData / WebAPI 🔗
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.