Updating Power Automate Flow Calls for Legacy Power Virtual Agents Imported into the Unified Canvas

In my last post I outlined how easy it is to take your legacy Power Virtual Agent bots and import them into the new Unified Canvas. However, if you had called any Power Automate Flows in your legacy bot, you’ve likely noticed that those calls are broken in the new Unified Canvas. This post is dedicated to helping you fix that!

The Issue

The reason the Power Automate flow calls that previously worked now throw errors in your topics all comes down to the type of data that Power Automate expects to get from your Power Virtual Agent. Power Automate Flows can in essence take in 3 types of data:

  1. Text
  2. Yes/No (boolean)
  3. Number

However, when your bots have an “Ask a Question” node that provides the user with a list of choices, instead of text, the variables those questions produce within PVA become a choice instead of text. In turn, if your PVA topic tries to send one of those choice values to Power Automate as an input, it will result in an error (‘BindingIncorrectTypeError’), as it knows Power Automate can’t handle that type of variable.

To be clear, this is an issue even in Topics built in the new Unified Canvas, but the legacy topics come over with a formula where the variable is passed into an OptionSetValue function that results in an error, since its an unknown method:

Picture of Error:

The Solution

Our solution is fortunately very easy. Wherever you have one of these choice variables as an input to a Power Automate flow, simply press the arrow next to the value, switch to the ‘Formula’ tab, and change the Formula from OptionSetValue({YourVariable}) to Text({YourVariable}).

In the above example, you’d simply change OptionSetValue(Topic.OS) to Text(Topic.OS). This will work whether you are dealing with a Topic or Global variable.

In new Topics built in the Unified Canvas, the process is the same, although you’ll notice that the variable is preselected, unlike the OptionSetValue formula imported from the legacy canvas, and you’ll just need to switch from the “Custom” (variable) tab to the “Formula” one, and utilize the Text({YourVariable}) function as outlined above.

As always, I hope this helped, and look forward to seeing you next time!

Cheers,
Matt

Matt Jimison

Microsoft 365 Geek - Husband, father, lover of basketball, football, smoking / grilling, music, movies, video games, and craft beer!

Leave a Reply

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