Dataverse: Web API Actions and Functions

Power Automate and the Dataverse Web API often cross paths. But there’s more to this relationship than meets the eye. If you’ve used Power Automate, you’ve likely come across the Dataverse connector. They primarily include basic functions, actions, and operations on entity sets/types.

You can also perform some other advanced actions through the connector. These are listed under “Perform a bound action” and “Perform an unbound action“. However, there’s a noticeable absence of an out-of-the-box actions for “Perform a bound/unbound function“. I’m going to try and explain what the different bound/unbound actions/functions means further down as well.

Behind the scenes the “Perform a bound action” and “Perform an unbound action” are basically HTTP requests being sent towards the Dataverse Web API exposed to perform operations on the data – such as create, read, update, delete. The Dataverse Web API is based on the OData protocol, which defines a set of standard actions and functions that can be applied to the available tables, records etc… In Power Automate, most of the available functions are missing.

If you’re curious about the Dataverse Web API endpoints through HTTP calls, you will be able to query and get a list of all the available actions and functions operations with the following URI: [Organization URI]/api/data/v9.2/$metadata by using the GET method

This URI will give you a full list of operations in the Microsoft.Dynamics.CRM namespace in XML format. Note: If you do this through a Power Automate flow with HTTP-action, you’ll need to download the file and get an unreadable Base64-string of the content.

This XML document is your go-to guide for everything related to Dataverse Web API. Use Ctrl+F on this document to find the available EntityType, Action, Function, ComplexType, or EnumType you want to use. Remember, the names are case sensitive.

Actions and functions differ in their effects. Actions can modify data (they have side effects), while functions can only return data. For example, you can use an action to merge two records or add a record to a queue. But, you can use a function to retrieve the current user or format an address.

Another distinction is the method they use: Actions use the POST method, while functions use the GET method. This means that actions can accept parameters in the request body, while functions accept parameters in the query string due to the GET method.

Functions are operations that return a value or a collection of values. They’re used to perform calculations, validations, conversions, or other logic that doesn’t modify data.  Every function has a Name attribute, which is part of the URL when you use HTTP GET, sending any defined parameters for the function in the URL of the request.

What is this bound or unbound actions functions you’ve mentioned about?

Dataverse Web API actions and functions can be either bound or unbound. If you look at the XML document from [Organization URI]/api/data/v9.2/$metadata, you’ll see some actions and functions with an additional attribute IsBound=”true”. All actions and functions with this attribute are bound, meaning that the first parameter is a reference to a table record or to an entity set.

For instance, you can create a bound function that returns the total number of contacts for an account, or an unbound action that sends an email to a specified recipient. Bound functions and actions are associated with a specific entity type or collection, and can be invoked by appending the function or action name to the entity set, entity, or property URL. On the other hand, unbound functions and actions are not associated with any entity type or collection, and can be invoked at the service root level.

Why combine Power Automate with Dataverse Web API functions:

  • Enhance the functionality of your Power Automate flows
  • Access advanced features and capabilities of the Dataverse platform
  • Reduce the need and development for custom API through plugins by leveraging Power Automate flows instead

For a full list of the above you can also use the official Microsoft Dataverse Web API Reference | Microsoft Learn

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *