Thoughts, Dynamics 365, random business ideas, etc.

What language does Power Automate use?

Power Automate and Logic Apps both use the same language, Workflow Definition Language (or WDL). The nice thing about Azure Logic Apps and Power Automate, though, is that there’s a fancy front end that allows you to generate most of the code without hands-on-keyboard.

Here’s an example. I built a small little flow that uses the Mailchimp connector trigger to find when a new contact is added to one of my lists (hint, hint). It then takes the outputs from the trigger and sends me a little message on Microsoft Teams telling me a new user signed up.

Simple Mailchimp to Microsoft Teams Power Automate flow

The “dynamic content” pane shows me all the available outputs that the UI was able to determine based on the connector’s documentation.

Sometimes, if you’re trying to access an HTTP endpoint instead, the Teams connector won’t be able to resolve the outputs. I usually handle this by tossing in a Parse JSON action which then will resolve the outputs. Sometimes, even that doesn’t work.

The Parse JSON action turning the outputs of the Request trigger into a more useful format.

In the above screenshot, you can see that the Parse JSON action DID get the outputs that I put in when I created the Parse JSON action. Certainly makes things a lot easier to refer to.

In this next screenshot, though, the Parse JSON didn’t quite work as I needed it to. When there’s nested objects or arrays sent into an action, you’ll get that stupid “For each” loop added around your object. Power Automate / Logic Apps both assume that you need to handle a case where there’s more than one line returned, and they try to help you out. In these cases, you might have to do some custom workflow definition language expressions.

Getting rid of the "For each" loop in Power Automate by navigating to the first record in an array.

In the “List contacts” action, I had already specified I only wanted 1 result, so I knew I was only going to get a single contact returned. To stop Logic Apps from adding a “For each” loop, I instead referred to the first object by adding a “[0]” between the value array and the contactid field. Voila – no more “For each” loop.

Anyways, long story short. Power Automate and Logic Apps use the Workflow Definition Language. Most users are going to be able to go their whole lives without having to know that or actually type any in, but it’s nice to know.

Learn more at the learning paths.


Comments

Leave a Reply

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

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