Dataverse Functions
Sometime in 2024 Microsoft released the low-code plug-ins feature for Dataverse. These provide a way to implement business logic that runs server-side (this means as part of the Dataverse platform) without having to write C# Code. The feature is marked as preview - you may be familiar with the standard Microsoft disclaimer for preview features in that they aren't meant for production use.
According to this article, low-code plug-ins will not make it out of preview because they have been replaced with Functions (not Azure Functions).
At the time of writing, Functions in Dataverse are also marked as preview.
Functions are reusable objects which execute commands defined using Power Fx. The function can take inputs with input parameters and return results with output results. The commands can reference up to five tables in the Dataverse database though they don't need to.
Where can Functions be used?
Functions can be used:
- In a Canvas app
- In a Custom page in a model-driven app
- In a Power Automate cloud flow
- With the Dataverse Web API (as an unbound action)
- From within another function
Example
Summarize opportunities for an account
In this example (assuming an environment with an Opportunities table), a function is used to return the following for an account:
- Number of open opportunities (integer)
- Number of won opportunities (integer)
- Number of lost opportunities (integer)
- Total value of won opportunities using Actual Revenue column (float)
- Total value of open opportunities using Estimated Revenue column (float)
To set up the function, in https://make.powerapps.com, select the relevant environment and then in a solution, select New > Automation > Function.
Alternatively from the left-hand navigation pane select More and then click Discover all and then scroll through the list to Functions and then click + New Function.

Working with a function in the navigation pane (outside of a solution) provides additional commands that can be performed on the function. These are Delete, Copy Code Snippet and Test. These don't show when working with a function in a solution. As per this article, don't delete a function in a solution, instead do it from the navigation pane.
Provide a value for Display name and Description.
Click on + New input parameter and for Name enter account and for Data type, select String. This parameter will receive the GUID of the account for which the summary is to be provided.
For the results, use + New output result to add a result for each of the five names and types from the list below.
name | type |
---|---|
open | integer |
won | integer |
lost | integer |
totalopen | float |
totalwon | float |
In Table references select Accounts and Opportunities.
In Formula enter the following code:
{
open:CountIf(opportunity, statecode = opportunity_opportunity_statecode.'0' && parentaccountid.accountid = GUID(account)),
won:CountIf(opportunity, statecode = opportunity_opportunity_statecode.'1' && parentaccountid.accountid = GUID(account)),
lost: CountIf(opportunity, statecode = opportunity_opportunity_statecode.'2'&& parentaccountid.accountid = GUID(account)),
totalopen: Sum(Filter(opportunity, statecode=opportunity_opportunity_statecode.'0' && parentaccountid.accountid = GUID(account)), estimatedvalue),
totalwon: Sum(Filter(opportunity,statecode=opportunity_opportunity_statecode.'1' && parentaccountid.accountid = GUID(account)),actualvalue)
}


Using the function in a canvas app
To use the function in a canvas app, click Add data and then search for and add Environment from the Microsoft Dataverse connector.
In the app, add the following command to a control (such as a button) to invoke the function:
Set(result,Environment.ecs_GetOpportunitySummary({account:"add GUID of account here"}))
To use the output of the function, use result.open, result.won, result.lost, result.totalopen or result.totalwon as the value for a control in the app.
For example, to show the total value of won opportunities in a text label, set the Text property to:
Concatenate("Won Opps: " ,Text(result.won))
Using the function in Power Automate
To use the function in a cloud flow:
- add a step to the flow
- select the Microsoft Dataverse connector
- select the Perform an unbound action action
- In Action Name, select the function
- Provide values for the input parameters
- Add a Compose action using the output of the unbound action as an input so that you can access the results of the function as needed.

Closing thoughts
Dataverse Functions provide another low-code way to implement business logic that runs server-side.
But remember that there are usually alternative ways to solve a requirement. In the example above an alternative is to create a rollup column in the opportunity table for each of the required output results which might be simpler but with the downside that results might be up to an hour out of date. The preferred solution is something for a functional consultant to decide.
Member discussion