Dynamics 365 Business Central: How to set a condition on a breakpoint in debugging (Conditional breakpoints)
Conditional breakpoints allow developers to pause code execution only when specified conditions are met during AL debugging in Business Central. This feature lets you filter breakpoints by variable or field values, reducing unnecessary pauses and focusing debugging efforts on specific scenarios.

post Dynamics 365 Lab
"If the condition evaluates as true, then code execution breaks at the breakpoint. If the condition is false, then code execution continues."
Key points
- Add a conditional breakpoint by right-clicking the editor margin, or edit an existing breakpoint, then enter an expression in the inline dialog.
- Execution stops only when the expression is true, for example Rec.“No.” equal to a specific posted sales invoice number.
- Literal comparisons work with simple types such as Integer, Decimal, Code, Text, Boolean, Option and Enum; arrays, lists, dictionaries, record fields and variants need version 26 or later.
- Comparison operators are always available, while numeric negation, NOT and AND/OR with parentheses arrive in version 26.
- Clearing the condition turns the breakpoint back into a normal one.
Quotes
- “If the condition evaluates as true, then code execution breaks at the breakpoint. If the condition is false, then code execution continues.” (Clarifies the fundamental behavior of conditional breakpoints and how they filter execution pauses based on true/false evaluation.)
- “The condition can include any variables or fields that are currently in scope.” (Defines the scope of what can be used in conditions, showing flexibility in debugging complex scenarios with multiple variables and fields.)
Context
- Features: conditional breakpoints, AL debugger, expression evaluation
- Versions: version 26, Business Central 2023 wave 2, Business Central 2023 wave 1, Business Central 2022 wave 2
Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.