Microsoft Releases Custom Power Fx Functions Feature for Power Automate

Today Microsoft released custom Power Fx functions to support reusable code within Power Automate. In this post how to create and use these custom functions.

Create a Custom Function

To create your custom functions you will have to create a solution first. Once the solution has been created you can select within Automation -> Function the right option to add the function.

Create a custom Power Fx function
Create a custom Power Fx function

Now comes the toughest part.

Microsoft Releases Custom Power Fx Functions Feature for Power Automate
Microsoft Releases Custom Power Fx Functions Feature for Power Automate 1

Create a SubString Function

As you might know, Power Automate does have a Substring Function. But I needed an easy example for this post.

I’m going to set a standard here first. Naming Custom functions. I’m going to use the prefix fun. This will help us identify the custom functions and hey, Cusotm Functions could become a nice new fun feature to use.

Our custom Power Fx function
Our custom Power Fx function

The formula that we create is actually an object that we need to create. so As I created a varResult property as an output property, my object that I generate needs this varResult property as well.

As we type the expression that we want, the intellisense will help us develop our code.

Intellisense with function
Intellisense with function

The code I used is:

Left(Right(OriginalText, Len(OriginalText) - First), Length)

Now, I will have a look at our soluiton. For just the one function, I’ve now got 6 objects added to my solution. Depending on your function definition this could be more or less.

Solution with multiple Power Fx objects
Solution with multiple Power Fx objects

If you want to update your function then edit the one that has been marked as Function in the Type column.

Use the Custom Power Fx function in a Power Automate flow

To call the function in a flow in Power Automate, just add the Perform an unbound action and select the function that we created.

Use the Power Fx function
Use the Power Fx function

Configure the unbound action
Configure the unbound action

With the above configuration of my unbound action, I’m now getting the result back that we expect.

Flow Run
Flow Run

So now we can find the result in the varResult shows the substring.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Related Posts

4 thoughts on “Microsoft Releases Custom Power Fx Functions Feature for Power Automate

  1. this sounds promising at least, no support for objects=records or arrays yet and cannot be used as “native” powerFX extensions (as a function as part of powerFX expression) though, if I get that right …

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.