Dataverse REST Builder and the Hidden Gems
I would like to start by saying that I use XRMToolbox a lot, I have in my favorites different plugins like FetchXML Builder, Solution Components Mover, User Settings Utility of course Plugin Registration tool and today I am going to talk about the one that has saved me a few times and that is Dataverse REST Builder.
Nowadays probably most consultants working with Dataverse and Power Platform also work with the XRMToolbox, no matter if you are a citizen developer or a pro-code developer, this is an amazing tool that helps us in many scenarios.
For example, when it comes to build a complex FetchXML that is not possible using the advance find in Dataverse, then FetchXML Builder is there to help you, I have lost count how many times I have used this plugin.
But as I mentioned this time I am going to talk about Dataverse REST Builder, and before I continue I would like to say thank you very much Guido Preite for this amazing plugin and thanks to the rest of heroes who have created all the other plugins for the XRMToolbox.
Without further introduction let’s start.
What is Dataverse REST Builder
As its creator claims, Dataverse REST Builder (DRB) is an application to create and execute requests against the Dataverse Web API endpoint.
And that is what this blogpost is about, how to create Dataverse Web API requests to call custom APIs or custom actions using the REST Builder plugin.
So why is this such an important topic for me, well, as a technical consultant I usually have to create Custom APIs and call them from somewhere else like a ribbon button, for example let’s say you have a requirement for a custom table “Contracts”, and the requirement says when the user clicks a button on the contract form to approve it, then some heavy logic needs to run behind it. For these types of scenarios I think Custom APIs are the way to go.
If you haven’t played with Custom APIs yet, I recommend you give it a try, imagine a Custom API as a classic plugin on steroids, with the advantage that you can set input and output parameters to the Custom APIs and you can call them from anywhere else in the platform.
So imagine you already have your Custom API, now the question arises, how can I call it from a ribbon button. And this is where Dataverse REST Builder comes into action.
Calling a Custom API using Dataverse REST Builder
First thing first, open XRMToolbox, connect to your environment and select the Dataverse REST Builder plugin:
After that click in File and then click in New Collection:
Next step is click in New request and select Execute Custom API:
Now you will have to select the table that your Custom API is related to or maybe you created an unbound Custom API as I do in some cases, let’s imagine it is an unbound one in this scenario, then you will have to select the Custom API itself:
As you can see I already have some unbound custom API in my developer environment, I am going to select the one called p365i_crudoperations, which receives an input parameter and that is the action you want to perform: create, read, update, delete:
The next step is to click in Xrm.WebAPI tab and you will get the code to execute the Custom API:
I’m sure you already know this, but the code above is JavaScript, so you can copy and paste this code into your JavaScript web resource to run the custom API from the ribbon button.
I’m not going to explain how to create the Custom API or the button or how to call a JavaScript code from the ribbon button because that’s not the purpose of this blogpost, if you want to know more about that, go and check out this blogpost I did a while ago.
Cool right?, with this you will be able to call any Custom API you create front-end with JavaScript. But this is just the beginning, because with Dataverse REST Builder you can see a lot of different out of the box actions that you can take benefit of.
Exploring out of the box Actions to call
Let’s start by changing the Request Type to Execute Action:
From the table list select Email and from the Action list select sendEmail:
This action as the name indicates sends an email.
The input parameter is the GUID of the email record and you can set the second parameter to true:
That GUID in the image above is this email in my Model Driven App:
And you can even run (as a test operation) this request, click on the Editor tab and then click on the Execute Code button:
And now as you can see the email is pending to be sent, I have not configured the email settings in my environment so that’s why it’s not being sent, but you get the idea.
So now you are probably wondering why I would use this pro-code approach when I can send an email using Power Automate, well in our Dataverse and Power Platform world there are many…many different business cases that require different approaches, but it is true that most cases you will end up sending email from a cloud flow.
However, the idea is to show you how many out of the box actions we can leverage from our code.
Below I will mention some of these out of the box actions that you can leverage in your code, something worth mentioning is that you will always need the GUID of the records:
AddMembersTeam
With this one you can add one or more users to a team:
SetParentSystemUser
With this one you can start defining your business hierarchy:
AddToQueue
With this one you can add a record into a specific queue:
Exploring out of the box Functions to call
Now let’s change the request Type to Function and let’s see some examples.
RetrieveBusinessHierarchyBusinessUnit
With this one you can retrieve all business units from the business unit hierarchy:
In my case I have 2 business units, if you execute it to see the result you will see a JSON array and the field we are looking for is the GUID of the parent business unit:
User functions
I won’t mention every action and function because this blogpost would be endless but here you can see how many functions you can call for the user table:
And just out of curiosity this is the result if I run the RetrieveUserLicenseInfo function:
A JSON array with all the licenses held by a specific user:
Extras
Lookup for records
You can leverage Dataverse REST Builder UI to lookup for records:
Leverage AI actions
You can even use out of the box AI actions, these are unbound:
Again out of curiosity I will execute AISentiment action, this is the text I will send as input parameter: “I don’t like the answer to my question”:
This is what I got:
Again but with a different text: “perfect I will follow your advice”:
This is what I got:
Conclusion
There are a lot of ready to use actions and functions that you can leverage in your code, keep in mind that you don’t have to build in your code everything from scratch, and this is something I sometimes do because I forget that Dataverse REST builder is there and I’m pretty sure that in some cases the action/CustomAPI I want to build is already there just to be used.
So If you didn’t know about this plgin, go and try it from the XRMtoolbox
You can install the plugin within XRMtoolbox, but if you know more about this plugin, here is the github.


Hello there! Welcome to my blog!
My name is Wilmer Alcivar and I’m a Power Platform fan
I’d love to share my knowledge, so please do not hesitate to connect!





