Study guide
10.1 Logic Controls: Conditions, Switches, Apply to Each & Do Until Loops
Microsoft Power Platform Functional Consultant PL-200
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Dataverse Tables, Relationships & Core Columns
1.1 Dataverse Table Types, Properties & Ownership 1.2 Table Relationships & Cascading Rules 1.3 Column Types, Formats, Primary Keys & Alternate Keys 1.4 Rollup, Calculated & Formula Columns with Power Fx
2 Chapter 2: Dataverse Data Management & Governance
2.1 Dataverse Search, Quick Find & Relevance Indexing 2.2 Auditing Configuration & Log Management 2.3 Duplicate Detection Rules & Settings 2.4 Bulk Record Operations, Data Import, Export & Templates
3 Chapter 3: Dataverse Security Model & Access Control
3.1 Business Units, Ownership Models & Modern BU Matrix 3.2 Security Roles, Privileges & Depth Levels 3.3 Teams Architecture: Owner, Access, and Microsoft Entra (AAD) Group Teams 3.4 Column-Level Security & Hierarchy Security Models
4 Chapter 4: Model-Driven App Fundamentals & Information Architecture
4.1 Model-Driven App Design, Site Map Navigation & Modern App Designer 4.2 Form Types: Main, Quick Create, Quick View & Card Forms 4.3 View Configuration, System Views, Personal Views & Filters
5 Chapter 5: Advanced Model-Driven App Components & Custom Pages
5.1 Custom Pages & Modern Commanding with Power Fx 5.2 Form Component Controls & Specialized UX Elements 5.3 Embedding Canvas Apps in Model-Driven Forms 5.4 Embedding Power BI Reports, Dashboards & Tiles
6 Chapter 6: Canvas Apps Structure, Formulas & Data Operations
6.1 Canvas App Architecture, Screens, Containers & Controls 6.2 Power Fx Formulas, Delegation & Data Source Limits 6.3 Variables (Context, Global), Collections & State Management 6.4 Triggering Power Automate Cloud Flows from Canvas Apps
7 Chapter 7: Power Pages Site Design, Navigation & Content
7.1 Power Pages Design Studio & Site Structure 7.2 Power Pages Templates, Styling & Responsive Layouts 7.3 Web Pages, Navigation Menus & Content Snippets
8 Chapter 8: Power Pages Data Integration, Forms & Web Roles
8.1 Power Pages Lists, Basic Forms & Advanced Forms 8.2 Table Permissions, Web Roles & Page Access Security 8.3 External Identity Providers & Authentication Configuration
9 Chapter 9: Power Automate Cloud Flow Fundamentals & Triggers
9.1 Cloud Flow Types: Automated, Instant, Scheduled & Desktop Overview 9.2 Dataverse Connector Triggers & Operational Filters 9.3 Standard Connectors, Custom Connectors & Connection References
10 Chapter 10: Cloud Flow Actions, Expressions & Logic Controls
10.1 Logic Controls: Conditions, Switches, Apply to Each & Do Until Loops 10.2 Variables, Data Operations & Dynamic Content Manipulation 10.3 Power Automate Expression Language (WDL / Functions) 10.4 Error Handling, Configure Run After & Scope Controls
11 Chapter 11: Business Process Flows & Guided Processes
11.1 Business Process Flow Architecture, Stages, Steps & Data Steps 11.2 Branching Rules & Multi-Entity Business Process Flows 11.3 BPF Action Steps, Workflows & Cloud Flow Execution 11.4 BPF Security Roles, Order & Process Lifecycle
12 Chapter 12: Classic Workflows, Business Rules & Modern Logic Extensibility
12.1 Classic Dataverse Workflows: Real-Time vs. Background (Async) 12.2 Business Rules: Scope & Actions 12.3 Low-Code Plug-ins in Dataverse: Automated vs. Instant 12.4 Troubleshooting Automations, Run History & Analytics
13 Chapter 13: Power Platform Environment Architecture & Security
13.1 Environment Types: Default, Sandbox, Production, Trial, Developer 13.2 Environment Governance, Groups, Routing & Capacity Management 13.3 Data Loss Prevention (DLP) Policies & Connector Classifications
14 Chapter 14: Application Lifecycle Management (ALM) & Solutions
14.1 Unmanaged vs. Managed Solutions & Solution Layering Mechanics 14.2 Solution Components, Dependencies, Publishers & Prefixes 14.3 Exporting, Importing, Upgrading & Patches 14.4 Solution Checker, App Checker & ALM Best Practices
15 Chapter 15: Enterprise Interoperability & Service Integration
15.1 Exchange / Server-Side Synchronization & Email Integration 15.2 SharePoint & OneDrive Document Management Integration 15.3 Microsoft Word & Excel Document Templates
16 Chapter 16: Copilot, AI Capabilities & Exam Strategy
16.1 Copilot Studio & Generative AI across Power Platform 16.2 AI Builder Prebuilt & Custom Models in Apps and Flows 16.3 PL-200 Exam Strategy, Time Management & Question Analysis
10.1 Logic Controls: Conditions, Switches, Apply to Each & Do Until Loops
Key Takeaways Explain This Topic AI
Condition actions provide binary branching ('If yes' / 'If no') supporting nested AND/OR logic groups and relational comparisons.
Switch actions provide multi-branch execution matching a single string or integer expression against up to 25 case branches plus an optional default case.
Apply to each iterates over JSON arrays, defaulting to parallel execution (up to 50 threads); setting Concurrency Control to 1 (Sequential) is mandatory when modifying variables to prevent race conditions.
Do Until loops execute actions iteratively until a condition evaluates to true, evaluating criteria at the end of each iteration (guaranteeing at least one run).
Do Until loops are governed by hard termination limits: Count limit (default 60, maximum 5,000) and Timeout limit in ISO 8601 format (default PT1H, maximum P30D), terminating whenever either threshold is reached.
Last updated: August 2026
Logic Controls: Conditions, Switches, Apply to Each & Do Until Loops
Process automation in enterprise environments rarely follows a strictly linear path. Real-world workflows demand sophisticated decision trees, parallel data processing, multi-path routing, and iterative polling against asynchronous backends. Within Microsoft Power Automate, Logic Controls are the architectural building blocks that govern execution flow. Built atop the Azure Logic Apps workflow engine, these control actions enable functional consultants to evaluate runtime expressions, route execution dynamically, iterate through collections, and repeat actions until specific business criteria are satisfied.
For the PL-200: Microsoft Power Platform Functional Consultant certification exam, you must master the operational mechanics, configuration limits, thread-safety considerations, and performance trade-offs across four core control structures: Condition , Switch , Apply to each , and Do Until .
1. Flow Control Architecture & Execution Mechanics
Every cloud flow action executes within a directed execution graph. Control actions act as container nodes that encapsulate child actions, dynamically evaluating conditions to determine whether child branches execute, how many times they repeat, and whether iterations run concurrently or sequentially. +-----------------------------------------------------------------------------+
- | POWER AUTOMATE LOGIC CONTROL TAXONOMY |
- | |
- | +---------------------------------------------------------------------+ |
- | | POWER AUTOMATE ENGINE RUNTIME | |
- | +---------------------------------------------------------------------+ |
- | | | | |
- | v v v |
- | +-----------------------+ +-----------------------+ +-----------+ |
- | | BRANCHING CONTROLS | | LOOPING CONTROLS | | CONTAINERS| |
- | | - Condition (If/Else) | | - Apply to each | | - Scope | |
- | | - Switch (Multi-Case) | | - Do Until | | - (Try/ | |
- | +-----------------------+ +-----------------------+ | Catch) | |
- | +-----------+ |
- +-----------------------------------------------------------------------------+
- 2. Condition Action: Binary Decision Branching
The Condition action evaluates one or more relational criteria to boolean true or false , splitting the flow into two mutually exclusive execution paths:
If yes (True branch): Executes when the compound logical condition evaluates to true .
If no (False branch): Executes when the compound logical condition evaluates to false . +-----------------------------------------------------------------------------+
- | CONDITION ACTION ARCHITECTURE |
- | |
- | +---------------------------------------------+ |
- | | CONDITION (Logical Evaluator) | |
- | | [Attribute / Value] [Operator] [Criteria] | |
- | +---------------------------------------------+ |
- | | |
- | +---------------+---------------+ |
- | | | |
- | [Evaluates TRUE] [Evaluates FALSE] |
- | v v |
- | +-----------------+ +-----------------+ |
- | | IF YES | | IF NO | |
- | | (Branch Actions)| | (Branch Actions)| |
- | +-----------------+ +-----------------+ |
- +-----------------------------------------------------------------------------+
- Relational Operators and Comparison Mechanics
Each row in a Condition compares a left operand (dynamic token or expression) against a right operand using a selected operator:
- Operator Description Data Type Compatibility
- is equal to / is not equal to Exact value equality or inequality String, Number, Boolean, Null
is greater than / is greater than or equal to Numeric or chronological comparison Integer, Float, ISO 8601 Date
- is less than / is less than or equal to Numeric or chronological comparison Integer, Float, ISO 8601 Date
- contains / does not contain Substring presence or item in collection String, Array
- starts with / does not start with Prefix evaluation String
- ends with / does not end with Suffix evaluation String
- Compound Logic Groups (AND / OR)
Makers can combine multiple comparison rows into complex relational statements:
And Group: All rows within the group must evaluate to true for the group to be true .
Or Group: If any row within the group evaluates to true , the group evaluates to true .
Nested Logic Groups: Sub-groups can be nested up to multiple levels deep (e.g., (Status eq 'Active' AND Revenue > 100000) OR (Tier eq 'VIP') ).
Caution
Data Type Coercion in Conditions: Power Automate enforces strict typing in expressions but attempts automatic coercion in the Condition designer. However, comparing an integer column statuscode (e.g., 864500001 ) against a string literal '864500001' will evaluate to false . Always ensure operands match in underlying data type, or use explicit conversion functions like int() or string() .
3. Switch Action: Multi-Path Routing
When a business requirement dictates evaluating a single variable or dynamic token against multiple discrete possible values (such as an approval status, order category, or state code), chaining multiple nested Condition actions becomes unreadable, error-prone, and inefficient. The Switch action provides clean, performant multi-way branching. +-----------------------------------------------------------------------------+
- | SWITCH ACTION ARCHITECTURE |
- | |
- | +---------------------------------------------------+ |
- | | SWITCH: On expression / token | |
- | | (e.g., triggerOutputs()?['priority']) | |
- | +---------------------------------------------------+ |
- | | | | | |
- | [Value = 'High'] [Value = 'Med'] [Value = 'Low'] [No Match] |
- | v v v v |
- | +-------------+ +-------------+ +-------------+ +-------------+|
- | | CASE 1 | | CASE 2 | | CASE 3 | | DEFAULT ||
- | | (Escalate) | | (Standard) | | (Batch Q) | | (Log Unk.) ||
- | +-------------+ +-------------+ +-------------+ +-------------+|
- +-----------------------------------------------------------------------------+
- Switch Configuration Rules & Limits
Target Expression: The Switch evaluates a single input expression or dynamic content token (typically of type String or Integer ).
Case Branches: You can configure up to 25 discrete Case branches per Switch action. Each Case specifies an exact matching value.
Matching Logic: The Switch performs strict equality matching ( equals ). It does not support inequality operators ( > , < , contains ) inside case headers.
Default Case: If the evaluated expression does not match any configured Case, execution routes into the Default branch. While configuring actions inside the Default branch is optional, it is best practice for defensive logging and unhandled scenario alerts.
Execution Exclusivity: Unlike programming languages that require a break statement to prevent fallthrough, Power Automate Switch cases are mutually exclusive; exactly one branch executes per evaluation.
4. Apply to Each Action: Array Iteration & Concurrency Control
The Apply to each action is a loop container designed to iterate through an incoming collection or array (such as records returned from Dataverse List rows , attachments from an email, or items from a SharePoint list). +-----------------------------------------------------------------------------+
- | APPLY TO EACH: CONCURRENCY MODES |
- | |
- | [DEFAULT: CONCURRENT (PARALLEL)] [SEQUENTIAL (DEGREE = 1)] |
- | - Up to 50 concurrent threads - Exactly 1 iteration at a time |
- | - Non-deterministic execution order - Strict chronological order |
- | - Fast throughput for independent tasks - MANDATORY when updating |
- | - DANGER: Variable race conditions! variables inside loop |
- | |
- | Thread 1: Item[0] -> API Call Iter 1: Item[0] -> Var = 1 |
- | Thread 2: Item[1] -> API Call Iter 2: Item[1] -> Var = 2 |
- | Thread 3: Item[2] -> API Call Iter 3: Item[2] -> Var = 3 |
- +-----------------------------------------------------------------------------+
- Dynamic Content Inside the Loop: item()
Within the loop body, child actions reference the current array element using the dynamic content token Current item (resolved in WDL as the item() function). If looping over an array of JSON objects, properties are accessed via item()?['FieldName'] .
Concurrency Control & Thread Safety
By default, modern Power Automate flows execute Apply to each loops in parallel to maximize throughput.
Degree of Parallelism: In the action's Settings pane, makers can enable Concurrency Control and configure the Degree of Parallelism from 1 to 50 .
The Variable Race Condition Trap: Variables in Power Automate are global to the entire flow execution run. If an Apply to each loop updates a variable (e.g., Increment variable , Set variable , or Append to array variable ) while Concurrency Control is set to parallel, multiple concurrent threads will read and write to the same memory space simultaneously. This produces race conditions, dropped increments, and corrupt data.
Important
PL-200 Golden Rule for Loops & Variables: Whenever a variable is modified inside an Apply to each loop, you MUST enable Concurrency Control on the loop and set the Degree of Parallelism to 1 (Sequential execution). If sequential processing causes performance bottlenecks, replace the loop-and-variable pattern with declarative Data Operations ( Select , Filter array , Join ).
5. Do Until Action: Conditional Repetition & Termination Limits
The Do Until action repeats a block of actions until a specified relational expression evaluates to true . It is standardly used for asynchronous polling patterns, such as waiting for a long-running external job to finish, polling a Dataverse row until an approval status changes, or retrying a transient service call with a Delay . +-----------------------------------------------------------------------------+
- | DO UNTIL LOOP EXECUTION |
- | |
- | +----------------------------------+ |
- | | ENTER DO UNTIL | |
- | +----------------------------------+ |
- | | |
- | v |
- | +----------------------------------+ |
- | | EXECUTE LOOP ACTIONS | |
- | | (e.g., Get row, Delay 60s) | |
- | +----------------------------------+ |
- | | |
- | v |
- | +----------------------------------+ |
- | | EVALUATE EXIT CONDITION | |
- | | (e.g., Status eq 'Completed') | |
- | +----------------------------------+ |
- | | |
- | +----------------+----------------+ |
- | | | |
- | [Condition FALSE] [Condition TRUE] |
- | [AND Limits NOT reached] [OR Limit REACHED] |
- | | | |
- | +-------- (Repeat Loop) v |
- | +----------------+ |
- | | EXIT LOOP | |
- | +----------------+ |
- +-----------------------------------------------------------------------------+
- Do-While Evaluation Semantics
Unlike traditional while loops in programming languages (which check the condition before executing the first iteration), Power Automate evaluates the Do Until exit condition at the end of each iteration . This guarantees that the actions inside the Do Until block will always execute at least once , regardless of the initial condition state.
Built-in Loop Limits (Guardrails)
To prevent infinite loops that consume infinite API calls and lock execution threads, Power Automate enforces strict runtime limits on every Do Until action. The loop terminates whenever either the exit condition evaluates to true OR either limit threshold is reached :
Limit Property Default Value Maximum Allowed Value Format / Description
Count Limit 60 iterations 5,000 iterations Positive integer representing maximum loop cycles.
Timeout Limit PT1H (1 Hour) P30D (30 Days) ISO 8601 Duration format ( PT1H = 1 hr, PT15M = 15 min, P1D = 1 day). // ISO 8601 Duration Syntax Cheat Sheet for PL-200:
- PT15M --> Period Time: 15 Minutes
- PT1H --> Period Time: 1 Hour
- PT2H30M--> Period Time: 2 Hours and 30 Minutes
- P1D --> Period: 1 Day
- P7D --> Period: 7 Days
- P30D --> Period: 30 Days (Platform Maximum)
Warning
Silent Exit on Limit Expiration: When a Do Until loop reaches its Count or Timeout limit without the exit condition becoming true, the action does NOT fail with an error; it completes with status Succeeded and continues to the next action! If downstream actions depend on the condition having actually been satisfied, you must place a Condition immediately after the loop to verify the final state.
6. Logic Control Architectural Comparison
Architectural Dimension Condition Switch Apply to each Do Until
Primary Purpose Binary true/false branching with complex AND/OR logic Multi-path routing for a single expression against discrete values Iterating over items in an array collection Repeating actions until an external condition becomes true
Branch / Iteration Limit 2 branches ( If yes / If no ) Up to 25 Cases + 1 Default Unbounded (bound by source array size & pagination) Max 5,000 iterations or 30 days (default 60 / PT1H)
Evaluation Timing Once upon entering step Once upon entering step Evaluates per item Evaluates at end of each loop iteration
Concurrency Support N/A (single execution) N/A (single execution) Configurable parallel (1 to 50 threads) Sequential by nature