If you work with Dynamics 365 and the Power Platform, you have worked with the FetchXML Builder, an XrmToolbox plugin built by Microsoft MVP Jonas Rapp. Most people are aware of its functionality from its name, a powerful tool that generates FetchXML without the user having to actually know any FetchXML. However, as powerful as this feature is, there are several other capabilities of the tool that are super useful. Here’s a list of some of my favorites.
1. OData 4.0
Once your FetchXML query is built, you can generate OData 4.0 WebAPI. Click on View->OData 4.0 (WebAPI):
In the bottom of the screen, you will see the generated URL:
Opening the url in a browser will run the query and display the resulting data:
Use the OData query wherever you need to. Note, it can also generate OData 2.0.
2. Power Automate Parameters
Let’s say you have a Power Automate flow that calls the List Records connector. FetchXML Builder will generate each of the fields you need to run the connector. From the Builder, click on View->Power Automate Parameters:
It displays a dialogue like below, with each of the fields:
Click on the Select hyperlink field. This will copy the value into the clipboard:
Copy this into the Power Automate List Rows connector, then repeat for each field:
Our flow runs successfully based on the query provided:
Of course, you can also paste the FetchXML right into the FetchXML Query field:
3. SQL Query
This is useful if you prefer or need a SQL query generated. Install the SQL 4 CDS plugin written by Mark Carrington for the XrmToolbox:
You can then generate your new SQL query based off your FetchXML query:
Click Edit in SQL 4 CDS:
The query is opened in SQL 4 CDS and can be run:
4. JavaScript and C# Code
Generating JavaScript or C# code is useful so we don’t need to go through the dirty work of typing the query out. Click on VIew->FetchXML JavaScript or C# code:
Copy the generated code:
Here I’m running the code in a browser console with the D365 org open, in a WebApi RetrieveMultiple query:
Along with C#, you also have a QueryExpression that can be generated:
5. Settings / Options
There are several settings you can change with the Builder. Click on Options:
This opens the Settings menu. Here there’s some useful things you can tweak.
For example, if you need single quotes in your output XML, that can be configured here by selecting “Use single quotation in rendered XML”:
You can also output the results as JSON:
6. Integration with Bulk Data Updater
The Bulk Data Updater is another tool built by Jonas Rapp. Click to open it from the toolbar of the FetchXML Builder:
The FetchXML query is automatically run to display the records in the Bulk Data Updater. From here, you can select to update all or selected records, the attributes you want to update, etc. The tight integration makes it simple to ensure you only update the records you are meant to:
7. Update Dynamics 365 Views
You can update D365 views directly from the FetchXML Builder. Select Open->Open View:
Select the view to update:
Make your FetchXML updates in the Builder, then click Save->Save View:
Click OK:
The view is now updated in D365:
8. Intellisense
Building queries is much easier when you know you’re not making a mistake. The tool has built-in intellisense so you at least limit your own typos:
The tool also reports errors as you create the query:
9. Repositories
You can now store multiple FetchXML queries as a “repository”. Save the queries in the repository, then when you open FetchXML Builder, you can open a given repository, which will give you access to the queries for that repository. A nice way to manage all your FetchXML queries:
10. Metadata
You can view metadata right within the FetchXML Builder. So when you’re building your queries and need metadata information of your tables, fields, etc, right click and Show Metadata right within the toolbox without having to tab over to another app.
The tool is a must have for Dynamics 365 and Dataverse development. Looking forward to more features from Jonas!
I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.
IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.
THANK YOU, AND LET'S KEEP LEARNING TOGETHER.
CARL