Classic Workflows in Model-Driven Apps
Classic Workflows in Model-Driven Apps: Complete Hands-on Guide
Classic workflows are server-side automation processes in Microsoft Dataverse. They are widely used in model-driven apps for validation, automation, approvals, and record management.
Classic Workflow Types and Their Usage
Classic workflows in model-driven apps can be executed in different modes depending on the business requirement. Each type serves a specific purpose and choosing the correct type is critical for performance and data integrity.
| Workflow Type | Execution Time | Can Stop Save | Typical Use Case | Example from This Blog |
|---|---|---|---|---|
| Background Workflow | After record is saved | No | Automation that should not block users, such as updating fields, sending notifications, or assigning records. | Set default Status to Draft when record is created. |
| Real-Time Workflow | Before record is saved | Yes | Validation and enforcement of business rules where incorrect data must not be saved. | Prevent submitting record when Amount is empty. |
| On-Demand Workflow | User-triggered | No | Manual execution when user explicitly wants to run a business process. | Manual Approve workflow executed from Run Workflow option. |
| Child Workflow | Called by another workflow | No | Reusable logic that should be maintained in one place and invoked from multiple parent workflows. | Lock Record workflow reused during approval. |
| Conditional Workflow | Depends on trigger | No | Decision-making based on conditions using IF / ELSE logic. | Auto approval based on Amount value. |
Best Practice: Use background workflows for automation, real-time workflows only for strict validation, on-demand workflows for user-controlled actions, and child workflows for reusable logic.
0️⃣ Understand Your Current Form (Base Table)
This example uses a custom User-owned Dataverse table. The base form contains the following fields:
- Name
- Owner
- Display Name
- Owning Business Unit (system)
- BusRules (custom text)
This setup is perfect for practicing all classic workflow types.
1️⃣ Add Required Columns (Very Important)
Add the following columns to the same table:
| Column Name | Type | Purpose |
|---|---|---|
| Status | Choice (Draft, Submitted, Approved, Rejected) | Triggers and conditional workflows |
| Amount | Currency | Approval logic |
| Submitted On | Date and Time | Background automation |
| Approval Comment | Multiple lines of text | Manual and approval workflows |
| Is Locked | Yes / No | Real-time validation and record locking |
Publish the table and add these columns to your form.
2️⃣ Classic Workflow – Type 1: Background Workflow (Create)
Scenario: Set default values when a record is created.
- Create a new workflow
- Category: Workflow
- Run in background
- Start when: Record is created
Steps:
- Update Record
- Status = Draft
- Is Locked = No
Result: Every new record starts in Draft automatically.
3️⃣ Classic Workflow – Type 2: Background Workflow (Update)
Scenario: Auto-fill Submitted On date when Status becomes Submitted.
- Start when: Record fields change
- Select field: Status
Condition:
Status equals Submitted
Action:
- Update Record
- Submitted On = Process Execution Time
- Save and activate your workflow
Start when - Record fields change
4️⃣ Classic Workflow – Type 3: Conditional Workflow (IF / ELSE)
Scenario:
- If Amount > 50,000 → Approved
- Else → Rejected
Condition:
Amount greater than 50000
YES branch: Status = Approved
ELSE branch: Status = Rejected
5️⃣ Classic Workflow – Type 4: Real-Time Workflow
Scenario: Prevent save if Amount is missing when submitting.
- Run as: Real-Time
- Start when: Record is created or updated
Condition:
Status equals Submitted AND Amount does not contain data
Action:
- Stop Workflow
- Status: Cancelled
- Error Message: Amount is mandatory before submitting the record
Result: User cannot save the record.
6️⃣ Classic Workflow – Type 5: Child Workflow
Scenario: Reusable logic to lock a record.
Child Workflow: Lock Record
- Run in background
- Available as child process
- No triggers configured
- Update Record → Is Locked = Yes
Parent Workflow: Lock On Approval
Status equals Approved AND Is Locked equals No
Action: Run Child Workflow → Lock Record
Child Flow:
7️⃣ Classic Workflow – Type 6: Manual Workflow (On Demand)
Scenario: User manually approves a record.
- Run in background
- Enable: As an on-demand process
Actions:
- Status = Approved
- Approval Comment = Approved manually
User action: Open record → More Commands → Run Workflow
To run the flow:8️⃣ Classic Workflow – Type 7: Assign Workflow
Scenario: Assign record to manager when submitted.
Status equals Submitted
Action:
- Assign Record
- Owner = Manager
Summary
Classic workflows support background automation, real-time validation, conditional logic, child processes, manual execution, and record assignment. Even today, understanding them is essential for maintaining legacy model-driven applications.
Comments
Post a Comment