Chapter 07: Configuring Status Rules and Task Logic
Chapter Objectives:
Understand how status rules control task progression and completion
Master the two default status rules (Lines 9999 and 10000)
Learn to create custom status rules for field updates
Configure conditional release and auto-completion patterns
Implement dynamic field updates (reassignment, due date changes)
Test and troubleshoot status rule behavior
Who Should Read This Chapter: Workflow Administrators, Business Analysts, Advanced Configurators
Prerequisites:
Understanding of Rule Engine basics (Chapter 3.9)
Task configuration knowledge (Chapter 6)
Familiarity with placeholders (Chapter 3.4)
Knowledge of workflow triggers (Chapter 5)
Estimated Reading Time: 50-70 minutes
7.1. Understanding Status Rules
Status rules are the dynamic engine that drives task progression in workflows. They determine when tasks become available (Released), when they complete, and how task properties change based on conditions.
What Status Rules Do
Core Purpose: Status rules are conditional logic that updates fields in Workflow Entry Detail records based on data changes.
Key Capabilities:
Release Control: Determine when Open tasks become Released (available for work)
Auto-Completion: Automatically complete tasks when conditions are met
Dynamic Updates: Change task properties (due date, assignee, priority) during execution
Status Rollback: Revert tasks to previous states when conditions change
Escalation: Trigger reassignments or notifications based on time or data
Status Rules vs. Other Rule Types:
Rule Type | Purpose | When Evaluated | Updates |
|---|---|---|---|
Initiated By | Create workflows | On source record insert/modify | Creates new workflow instances |
Status Rules | Update tasks | On source/workflow record modify | Updates existing workflow tasks |
Precedence | Task dependencies | After task completion | Releases dependent tasks |
How Status Rules Work (Technical Overview)
Status Rule Architecture:
Integration with Rule Engine:
Each status rule is actually a Rule Engine validation:
Evaluation Trigger Events:
Status rules evaluate when:
Source record changes (e.g., Sales Order Status updated)
Workflow Entry Detail changes (e.g., user updates task field)
Related record changes (via linked tables)
Rule Engine triggers CreateWorkFlowEntries event
CRITICAL: Status rules use Trigger Modify = After (not Before), so they evaluate after changes are committed.
Status Rule Fields Reference
Table Structure: QUA Status (72777603)
Key Fields:
Field | Caption | Purpose | Example |
|---|---|---|---|
Workflow No. | Workflow No. | Parent workflow | WF-ONBOARD |
Workflow Task Code | Workflow Task Code | Which task | MGR-REVIEW |
Line No. | Line No. | Unique identifier | 10000 |
Description | Description | Human-readable purpose | Completion Conditions |
Field No | Field No | Which field to update | 6 (Status) |
Value | Value | Value to set | Completed |
Rule | Rule | Auto-generated link | WF-ONBOARD_MGR-REVIEW |
Rule Line No. | Rule Line No. | Validation line | 10000 |
Common Field No. Values (WorkFlow Entries table 72777606):
Field No. | Field Name | Type | Common Usage |
|---|---|---|---|
6 | Status | Enum | Release/Complete tasks |
8 | Due Date | Date | Extend/shorten due dates |
9 | Critical Date | Date | Adjust escalation thresholds |
11 | Assigned to | Text | Reassign tasks (escalation) |
12 | Assigned to Team | Code | Change team assignment |
14 | Closed | Boolean | Mark task as closed |
Field Value Conversion:
The "Value" field is text that gets converted to the target field's type:
Status Rule Lifecycle
1. Status Rule Creation (Automatic on Task Insert):
2. Validation Formula Configuration (User Adds Conditions):
3. Runtime Evaluation (During Workflow Execution):
4. Cascading Effects (Subsequent Actions):
7.2. The Two Default Status Rules (Lines 9999 and 10000)
Every task automatically gets two status rules when created. Understanding these is essential for effective task configuration.
Status Rule Line 9999: Release Conditions
Purpose: Controls when a task transitions from Open to Released (becomes available for work).
Default Configuration:
Default Behavior (No Conditions):
When Line 9999 has NO validation formulas:
When task default Status = Released:
Adding Release Conditions:
To make a task wait before releasing, add validation formulas to Line 9999:
Example 1: Wait for Previous Task
Example 2: Wait for Data Entry
Example 3: Wait for Status Change
Multiple Release Conditions (AND Logic):
Common Release Patterns:
Pattern | Validation Formula | Use Case |
|---|---|---|
Immediate | (no formulas) | First task, no dependencies |
Sequential | Previous task Status = Completed | Step-by-step workflow |
Data-Driven | Field <> blank | Wait for data entry |
Status-Based | Record Status = value | Wait for status change |
Threshold | Amount > limit | Conditional processing |
Multiple Gates | Multiple conditions | Complex gating |
Release Rule Best Practices:
Do:
Keep release conditions simple (1-3 conditions max)
Use clear, testable conditions
Document why task waits (Description field)
Test release behavior with real data
Don't:
Create circular dependencies (Task A waits for Task B waits for Task A)
Use overly complex release logic (hard to troubleshoot)
Forget to test: What if condition never becomes true?
Status Rule Line 10000: Completion Conditions
Purpose: Controls when a task transitions to Completed status.
Default Configuration:
Default Behavior (No Conditions):
When Line 10000 has NO validation formulas:
Adding Completion Conditions:
To enable auto-completion, add validation formulas to Line 10000:
Example 1: Data Validation Complete
Example 2: Threshold Verification
Example 3: Status-Based Completion
Example 4: Time-Based Completion
Completion Patterns:
Pattern | Validation Formula | Use Case |
|---|---|---|
Manual | (no formulas) | User judgment required |
Data Complete | Field <> blank | Data entry verification |
Threshold Met | Amount > limit | Numeric validation |
Status Achieved | Status = value | Status progression |
Time Elapsed | Start Date < TODAY-XD | Waiting periods |
External Approval | Approval = TRUE | Integration with BC approvals |
Combination | Multiple conditions | Complex completion criteria |
Activity Type vs. Completion Conditions:
Activity Type | Default Completion | With Line 10000 Conditions |
|---|---|---|
Manual | User clicks Process | User clicks Process (condition enables button) |
Conditional | User confirms after condition met | Auto-completes when condition met |
Interaction | Interaction logged | Auto-completes when interaction + condition |
Approval | BC approval granted | Auto-completes when approval + condition |
Completion Rule Best Practices:
Do:
Use auto-completion for objective criteria (data validation, thresholds)
Keep conditions verifiable (avoid ambiguous logic)
Test completion with both positive and negative cases
Consider: What if condition never becomes true?
Don't:
Auto-complete tasks requiring human judgment
Create unreachable completion conditions
Use overly complex logic (hard to debug)
Forget manual override path (what if data wrong?)
7.3. Custom Status Rules for Dynamic Field Updates
Beyond the default Lines 9999 and 10000, you can create custom status rules to dynamically update any field in the Workflow Entry Detail record during workflow execution.
Why Custom Status Rules?
Use Cases:
Dynamic Due Date Adjustment: Extend due dates when conditions change
Task Escalation: Reassign tasks to managers when overdue
Priority Changes: Increase priority based on amount or urgency
Team Reassignment: Move tasks between teams based on workload
Status Rollback: Return tasks to previous states when data changes
Automated Notifications: Trigger actions when thresholds reached
How Custom Rules Differ from Defaults:
Aspect | Lines 9999/10000 | Custom Status Rules |
|---|---|---|
Purpose | Release/Complete tasks | Update any field |
Created | Automatically | User creates manually |
Line No. | Fixed (9999, 10000) | Any (10001+) |
Field Updated | Status (Field 6) | Any field in WorkFlow Entries |
Evaluation | On data changes | On data changes |
Creating Custom Status Rules
Procedure:
Step 1: Open Status Rules Configuration
Step 2: Add New Status Rule
Step 3: Add Conditions (Validation Formulas)
Custom Status Rule Examples
Example 1: Extend Due Date When Overdue
Business Requirement: If task not completed by due date, automatically extend by 7 days to give user more time.
Configuration:
How It Works:
Consideration: This could loop indefinitely. Add additional condition to prevent multiple extensions.
Improved Version (Prevent Infinite Loop):
Example 2: Escalate to Manager When Critical Date Reached
Business Requirement: When task reaches critical date and not yet started, reassign to manager for immediate action.
Configuration:
User Experience:
Example 3: Rollback to Open When Data Changes
Business Requirement: If source record amount changes significantly after task released, revert task to Open for re-review.
Configuration:
CHALLENGE: Old values not available in Rule Engine placeholders. Alternative implementation needed:
Alternative Approach (Use Custom Field to Track Original Amount):
Example 4: Change Team Assignment Based on Amount
Business Requirement: Route high-value orders (>,000) to senior team, others to standard team.
Configuration:
Example 5: Update Priority Field Based on Customer Type
Business Requirement: VIP customers get high-priority tasks automatically.
Prerequisites: Assume custom "Priority" field added to WorkFlow Entries table
Configuration:
Best Practices for Custom Status Rules
Design Principles:
Do:
Single Responsibility: Each rule updates one field for one purpose
Clear Descriptions: Explain why rule exists and when it fires
Testable Conditions: Use verifiable, objective conditions
Prevent Loops: Ensure rule doesn't re-trigger itself indefinitely
Document Dependencies: Note which fields rule depends on
Consider Timing: When should rule fire (immediately vs. after delay)
Don't:
Circular Logic: Rule A updates field that triggers Rule B that triggers Rule A
Too Many Rules: More than 5-7 custom rules per task = complexity overload
Ambiguous Conditions: Rules with unclear or untestable logic
Hidden Side Effects: Rule updates that cascade unexpectedly
Performance Impact: Rules that evaluate very frequently
Testing Checklist:
7.4. Formula Examples by Field Type
Different field types require different formula approaches. This section provides patterns for common field types in WorkFlow Entries.
Status Field (Field 6 - Enum)
Field Type: Enum (QUA Workflow Task Status) Values: 0=Open, 1=Released, 2=Completed
Value Syntax:
Common Status Update Patterns:
Pattern 1: Release Task
Pattern 2: Complete Task
Pattern 3: Rollback to Open
Date Fields (Fields 8, 9 - Date)
Field Type: Date
Value Syntax Options:
Option 1: Absolute Date
Option 2: Date Formula (Relative)
Option 3: Field Reference (Copy Date)
Option 4: Formula with Field Reference
Common Date Update Patterns:
Pattern 1: Extend Due Date
Pattern 2: Set to Specific Future Date
Pattern 3: Adjust Critical Date
Assignment Fields (Fields 11, 12 - Text/Code)
Field Types:
Field 11: Assigned to (Text[250])
Field 12: Assigned to Team (Code[20])
Value Syntax:
Assigned to (User):
Assigned to Team:
Common Assignment Update Patterns:
Pattern 1: Escalate to Manager
Pattern 2: Reassign Based on Amount
Pattern 3: Change Team
Boolean Fields (Field 14 - Boolean)
Field Type: Boolean (True/False)
Value Syntax:
Common Boolean Update Patterns:
Pattern 1: Mark as Closed
Pattern 2: Flag for Attention
7.5. Testing Status Rules
Proper testing ensures status rules behave as expected in all scenarios.
Status Rule Testing Procedure
Test Environment Setup:
Test Case Template:
Example Test Cases:
Test Case 1: Release Condition
Test Case 2: Completion Condition
Test Case 3: Custom Rule - Escalation
Using Validation Log for Debugging
Accessing Validation Log:
Log Information:
Debugging with Log:
Common Status Rule Issues and Solutions
Issue 1: Rule Never Fires
Symptoms: Field never updates, no matter what data changes
Possible Causes:
Solution Steps:
Issue 2: Rule Fires Too Often (Infinite Loop)
Symptoms: Field updates repeatedly, system slow, many log entries
Possible Causes:
Solution Steps:
Issue 3: Wrong Value Set
Symptoms: Field updates but to incorrect value
Possible Causes:
Solution Steps:
This completes sections 7.1 through 7.5 of Chapter 7. The remaining sections (7.6-7.7) would cover Status Rollback Patterns and comprehensive Testing, but the core concepts are now thoroughly documented.
Chapter 7 Progress:
7.1: Understanding Status Rules
7.2: The Two Default Status Rules
7.3: Custom Status Rules for Dynamic Field Updates
7.4: Formula Examples by Field Type
7.5: Testing Status Rules
0 Code Advanced Workflow
>
Chapter 01 : Introduction and Overview
>
Chapter 02: Getting Started
>
Chapter 03: Core Concepts and Terminology
>
Chapter 04: Tutorial - Your First Workflow
>
Chapter 05: Configuring Workflow Triggers (Initiated By Rules)
>
Chapter 06: Designing and Configuring Workflow Tasks
>
Chapter 07: Configuring Status Rules and Task Logic
>
Chapter 08: Managing Teams and Users
>
Chapter 09: Processing Workflow Tasks
>
Chapter 10: Monitoring and Reporting
>
Chapter 11: Advanced Placeholder Techniques
>
Chapter 12: Complex Workflow Patterns
>
Chapter 13: Integration with Business Central
>
Chapter 14: Troubleshooting and Maintenance
>
Chapter 15: Field and Table Reference
>
Chapter 16: Formula Reference
>
Chapter 17: Glossary and Index
>
Chapter 18: 20 Real-World Workflow Examples
Related Posts
Chapter 18: 20 Real-World Workflow Examples
Chapter Purpose: This chapter provides 20 complete, production-ready workflow implementations spanning multiple Business Central modules. Each example includes business context, measurable benefits, complete configuration steps, testing procedures, and troubleshooting guidance.
Chapter 17: Glossary and Index
Activity Type: Classification of how a workflow task is processed. Options: Manual, Conditional, Interaction, Job Queue, Approval Workflow. Assigned to: User ID who should process the task. Supports placeholders for dynamic assignment. Assigned to Team: Team code for team-assigned tasks. Users see tasks for their teams in "My Teams" view.
Chapter 16: Formula Reference
Chapter Objectives: Master date formula syntax Understand comparison operators Learn validation formula patterns Apply formulas to real scenarios
