Apply Power Fx in Workflows
Unit 6 of 10 · Module 12: Build agent-driven workflows using Microsoft Foundry
Before you start
Short explainers for ideas this lesson builds on. Watch these first if they're new to you.
Read this lesson
Formulas on the chalkboard
Picture an old sweet shop, with a chalkboard where the owner writes little rules: if a jar holds fewer than ten sweets, reorder it; add up today's sales. Power Fx is that chalkboard for your workflow. It's a low-code formula language that feels like Excel, and it's the glue between nodes. You use it wherever the workflow decides something, sets a variable, or loops. Every formula works out a value, and it can read two kinds of variables. System variables describe the conversation, like the user's last message. Local variables hold what your workflow saved along the way. Always write the prefix, System dot or Local dot, or you'll get an error saying the name isn't valid.
Everyday formulas
Here are some everyday formulas. Upper of Local dot Input shouts the text in capitals, Lower does the opposite, and Len counts its characters. Local dot Confidence greater than 0.8 gives true or false. If, with a condition and two values, picks one: proceed or escalate. Sum adds up numbers, or one column of a table, like the amount on every order. Count tells you how many items there are, IsBlank checks for an empty value, and IsEmpty checks for an empty table. ForAll applies a formula to every item, and Concatenate joins text, like a first name, a space, and a last name. Inside a message, wrap a formula in curly braces, and the workflow fills in the result.
Decisions and loops
Formulas really earn their place in two nodes. In an If/Else node, the condition is a Power Fx formula. It can check a structured agent output, like whether the confidence score beats a threshold, and decide between carrying on automatically and escalating to a person. In a For each node, a formula picks the list to walk through, so one set of steps handles every item, like a whole batch of support tickets, without copying nodes. If a formula complains about a type mismatch, convert the value with Text or Value.
Facts from Microsoft's documentation: Build a workflow in Microsoft Foundry (Preview); Power Fx overview (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.