DEV Community

Cover image for Functions in Dataverse & Low-Code Plug-ins 101
david wyatt
david wyatt Subscriber

Posted on

Functions in Dataverse & Low-Code Plug-ins 101

Functions in Dataverse (still known as Power FX Functions in some places) are cool, hopefully you agree that's why you are reading this blog 😎

Functions in Dataverse are server side Power FX code that you can call from an API, and that means you can call it anywhere (App, Flow, Agent, etc).

It has 2 versions

  • Instant
  • Automated*

If you think of them like Power Automate flows, so instant is like Button triggers, Automated like on email received. Except as this is all Dataverse, the trigger can only be a Dataverse table record (Create, Modify, Delete).

But I realised I've jumped ahead a little, as the tale of Power FX Functions is a little more complex (thats why there is a * next to Automated).

They started off as Dataverse Low-Code Plug-ins, and were accessed through a Microsoft created Model Driven App called the 'Dataverse Accelerator App' (Not Low-Code Plug-in app). It started off, how to say this, very Minimum Viable Product, it was buggy as hell, with little to no documentation (something that still isn't brilliant).

I wrote more about it here Let's Talk About Dataverse Low Code Plugins, what was wrong, and why I was excited about the potential.

Since then a few things have changed.

  • Got renamed to 'Low-Code Plug-ins in Dataverse'
  • Most Bugs fixed
  • New Power FX functions/expressions added
  • The Accelerator app is now more than Plug-ins, with API explorer (so the name is right now)
  • It was replaced with Power FX Functions (well kind of)
  • Power FX Functions have been renamed to 'Functions in Microsoft Dataverse'

That's right, even though it still shows as Power FX functions, in the docs it's been renamed to Functions in Microsoft.

studio

doc

I must have missed the comms on the new name, but with how often Microsoft renames its products I'm not sure the comms team can keep up.

Any way back to it, that's right, technically Functions in Dataverse and Dataverse Low-Code Plug-ins are 2 different tools, with their own MS Learn Docs having their own sections.

ms docs

And this is where it gets interesting, as you would think Low-Code Plug-ins are being replaced with Functions in Dataverse, as they do the same thing, just Functions in Dataverse are built into Power Apps studio, so its more legit. But it hasn't replaced, its been split into 2, with instant Low-Code Plug-ins have been 'deprioritized', whatever that means.

deprioratised

So now in theory Microsoft wants you to do Automated Plug-ins in Dataverse Accelerator, and Instant Plug-ins/Functions, in Power FX Functions.

If how long Power Platforms features spend in the purgatory that is 'Preview', I suspect Instant will have no feature updates and occasional critical bug fixes/shared updates from Power FX Functions. With the eventual goal to move missing features to Power FX Functions and maybe Automated.

That's right, Low-Code Plug-ins are better, and I really should have named it Low-Code Plug-ins and Power FX Functions, but Power FX functions are the future so I click baited you, so what are the differences.

Functions in Dataverse

  • Accessed through make.powerapps.com
    power app studio

  • Testing by Function
    test fucntion

  • Logs can only be seen in Dynamics advanced settings

Not so Legacy Advanced Settings
not so legacy

Legacy Advanced Settings
legacy logs

  • Max 5 different tables per function

  • Only Instant, there are no automated (at the point of print)

  • Limited to just Dataverse
    power fx function no to connection refs

Low-Code Plug-ins in Dataverse

  • Accessed through Dataverse Accelerator Model Driven app that has to be installed into the environment
    install

  • Testing is done in API Playground (added ability to select any plug to test)
    test plugin

  • Logs can be accessed in the Dynamics advanced settings and also in the monitor section in the Model Driven App
    monitor
    Note Functions in Dataverse appear in this monitor screen and are indistinguishable from Low-Code Plug-ins

  • More then 5 tables can be referenced in instant plug-ins

  • You can do automated plug-ins based on table events

  • The big one, Low-Code Plug-ins can use Connection references and use any action, like send emails
    send email


So you can see why I think Low-Code Plug-ins are better, they have better monitoring, and most important:

  • There is also Automated
  • They can call any action, so not just limited to Dataverse

I'm super confused, as in theory they have spun off instant from Dataverse, but then removed the functionality beyond Dataverse (connections), if someone can explain please do in the comments 🤷‍♂️

What They Are Useful For

Well Automated Plug-ins (I'm going to use Plug-ins instead of Functions for everything, as Functions for me are the actual function, like Patch() and Set()) are a great replacement for Business Process. Some good examples are:

  • Validating rules in Model Driven Apps
  • Set Owning Business Unit based on Lookup
  • Calculating Columns based on sums from other tables
  • Transactions (Groups of database writes that if one fails roll back all)

Instant have a bigger but less obvious scope, but some are:

  • Reusable functions across all tools (Power Apps, Power Automate, Copilot Studio)
  • Complex Row creation (create related rows in other tables at same time)
  • Add functionality to Power Automate (Regex)
  • Replace Basic Flows (save API calls)

Before you start

If you going with Low-Code Plug-ins then you need to install the Dataverse Accelerator App, an Environment admin is required and they need to find and install it from the Dynamics Apps in Resources.

For Logging you need to ensure Plugin logging is on, to do this:

1 Go to Advance Settings (Power Apps Setting Cog in top right)
2 Select Auditing (you can see Plug-in runs in customization menu)

audit

audit

3 Select Global Audit Settings
4 Customization tab, select All for Plug-in and custom workflow activity tracing

PPAC extra step

tracing

Basic Code

Power FX maybe used, but not all Power FX is equal, with certain functions (see why I prefer Plug-ins 😎) not available.

Currently not supported:

not supported
Latest list here

You can't have variables within your code, the closes you have is using the With() function, but you may have seen Set() is supported, and that's because its used to set the current record you are working on (if Automated), just like a Patch(). With the added benefit it does not trigger an update event, stopping infinite loops.

You Need to Know

A big one to be aware of is Plug-ins have a 2 minute max runtime, so if you try and overload it with to much code or items in a loop it will timeout.

If using the Automated on Modify, be careful not to create infinite loops, as there are no built in trigger conditions.

Uses the Owners connection to Dataverse, so they need access to the table and it shows as modified by them.


So that's a quick intro to Functions in Dataverse/Low-Code Plug-ins in Dataverse, I have 2 follow on blogs coming over the next 2 weeks going into more detail around the how. Subscribe below if you want to be notified (or click the links if you are reading this in the distant future).

Top comments (0)