Workflows Overview¶
Workflows are the heart of Zenzero ZAI's automation capabilities. They combine multiple actions into repeatable, reliable sequences that handle complex IT tasks with minimal manual intervention.
What is a Workflow?¶
A workflow is a predefined sequence of actions that automates a business process or IT operation. Instead of manually performing each step, you trigger the workflow and let ZAI execute all steps automatically.
Workflow vs. Individual Actions¶
Task: Onboard new employee
- Open M365 admin center
- Create user account
- Copy user ID
- Assign appropriate license
- Find department groups
- Add user to groups
- Document credentials
- Update ConnectWise ticket
- Send welcome email
Time: 15-20 minutes Error rate: ~15% (missed steps, wrong settings)
Task: Onboard new employee
- Type: "Onboard new employee Jane Smith"
- Review approval card
- Click "Approve & Run"
Time: 2-3 minutes Error rate: ~1% (validation built-in)
Efficiency Gains
Workflows reduce task time by 80-90% and errors by 90-95% through automation and validation.
How Workflows Work¶
graph TB
A[User Triggers Workflow] --> B[AI Detects Intent]
B --> C[Load Workflow Definition]
C --> D[Gather Required Parameters]
D --> E{All Parameters Available?}
E -->|No| F[Ask User for Missing Info]
F --> D
E -->|Yes| G[Show Approval Card]
G --> H{User Approves?}
H -->|No| I[Cancel Workflow]
H -->|Yes| J[Execute Step 1]
J --> K{Step Success?}
K -->|Yes| L{More Steps?}
L -->|Yes| M[Execute Next Step]
M --> K
L -->|No| N[Workflow Complete]
K -->|No| O[Stop & Report Error]
style A fill:#4285f4,color:#fff
style G fill:#f4b400,color:#000
style N fill:#0f9d58,color:#fff
style O fill:#ea4335,color:#fff
Workflow Components¶
Every workflow consists of:
| Component | Description | Example |
|---|---|---|
| Name | Workflow identifier | "M365 User Onboarding" |
| Description | What the workflow does | "Creates user, assigns license, adds to groups" |
| Parameters | Required inputs | user_email, display_name, license_sku |
| Steps | Actions to perform | 1. Create User, 2. Assign License, 3. Add to Group |
| Outputs | Results returned | user_id, password, license_name |
Workflow Types¶
1. User Management Workflows¶
Purpose: Create, modify, and manage M365 users
| Workflow | What It Does | Common Use |
|---|---|---|
| Create M365 User | Creates new user account | New employee onboarding |
| Disable M365 User | Disables account, removes licenses | Employee offboarding |
| Reset User Password | Resets password, revokes sessions | Forgotten password, security incident |
| Update User Details | Changes display name, usage location | Name change, relocation |
2. License Management Workflows¶
Purpose: Assign and manage M365 licenses
| Workflow | What It Does | Common Use |
|---|---|---|
| Assign License | Adds one or more licenses | Provision new user |
| Remove License | Removes licenses | Cost optimization, user leaving |
| Swap Licenses | Removes old, assigns new | User role change (E3 → E5) |
| Audit Licenses | Lists all license assignments | Compliance review |
3. Group Management Workflows¶
Purpose: Manage M365 and security groups
| Workflow | What It Does | Common Use |
|---|---|---|
| Add User to Group | Adds user to one or more groups | Department assignment |
| Remove from Group | Removes user from groups | Role change |
| Create Group | Creates new M365 or security group | New department/team |
| List Group Members | Shows all members of a group | Audit, verification |
4. Mailbox Operations Workflows¶
Purpose: Manage Exchange mailboxes
| Workflow | What It Does | Common Use |
|---|---|---|
| Convert to Shared | Converts user mailbox to shared | User departure, keep data |
| Grant Mailbox Access | Gives another user access | Manager needs access |
| Set Auto-Reply | Configures out-of-office message | Vacation, leave |
| Forward Emails | Sets up email forwarding | Temporary coverage |
5. Composite Workflows¶
Purpose: Multi-step business processes
| Workflow | What It Does | Common Use |
|---|---|---|
| Complete Onboarding | Create + License + Groups + Welcome | New hire |
| Complete Offboarding | Disable + Remove Licenses + Convert Mailbox | Employee exit |
| Role Change | Remove old groups + Add new groups + Swap license | Promotion, transfer |
| Security Incident | Reset password + Revoke sessions + Audit access | Compromised account |
Workflow States¶
Workflows progress through several states across their full lifecycle - from creation through to execution:
Design & Approval States¶
Before a workflow can be triggered by users, it goes through a design and approval lifecycle:
stateDiagram-v2
[*] --> Draft: Created / Edited
Draft --> AwaitingReview: Submit for Review
AwaitingReview --> Approved: Reviewers Approve
AwaitingReview --> ChangesRequested: Changes Requested
ChangesRequested --> Draft: Edit in Designer
Approved --> Active: Admin Activates
Active --> Draft: Edit in Designer (new draft)
| State | Description |
|---|---|
| Draft | Workflow is being designed or edited. Not yet available for execution. Changes are tracked with version control. |
| Awaiting Review | Submitted for approval. Approvers are notified via bell icon and toast notifications and can approve or reject from the review page. |
| Changes Requested | Reviewers requested modifications. Returns to draft for editing. |
| Approved | Approved by reviewers. Ready to be activated by an admin. |
| Active | Live and available for users to trigger. |
Version Control
Every save in the designer creates a version snapshot. Admins can view version history and restore previous versions at any time. See Workflow Designer - Version Control for details.
Execution States¶
When a user triggers an active workflow, it progresses through execution states:
stateDiagram-v2
[*] --> Pending: Workflow Triggered
Pending --> Approved: User Approves
Pending --> Cancelled: User Cancels
Approved --> Running: Execution Started
Running --> Running: Processing Steps
Running --> Completed: All Steps Success
Running --> Failed: Step Error
Running --> PartialSuccess: Some Steps Failed
Completed --> [*]
Failed --> [*]
PartialSuccess --> [*]
Cancelled --> [*]
note right of Running
Step 1: ✅ Complete
Step 2: ⏳ Running
Step 3: ⏹️ Pending
end note
State Descriptions¶
| State | Icon | Description | What You See |
|---|---|---|---|
| Pending | ⏸️ | Awaiting approval | Approval card displayed |
| Approved | ✅ | User approved | Execution starting... |
| Running | ⏳ | Executing steps | Real-time progress updates |
| Completed | ✅ | All steps succeeded | Success summary with outputs |
| Failed | ❌ | A step failed | Error message with details |
| PartialSuccess | ⚠️ | Some steps failed | Mixed results summary |
| Cancelled | 🚫 | User cancelled | Cancellation confirmation |
Step Execution¶
Each workflow step executes sequentially:
Step States¶
graph LR
A[Pending] -->|Start| B[Running]
B -->|Success| C[Completed]
B -->|Error| D[Failed]
B -->|Timeout| E[Failed]
style A fill:#ffa500,color:#000
style B fill:#4285f4,color:#fff
style C fill:#0f9d58,color:#fff
style D fill:#ea4335,color:#fff
style E fill:#ea4335,color:#fff
Step Information¶
For each step, you can see:
- Step Name - What action is being performed
- Status - Pending, Running, Completed, Failed
- Inputs - Parameters passed to the action
- Outputs - Results returned from the action
- Duration - How long the step took
- Error Details - If step failed, why it failed
Example step display:
✅ Step 1: Create M365 User
Status: Completed
Duration: 2.3 seconds
Inputs:
• tenant_id: ca735f40-c2de-4ec8-9b6f-c96fd3dee932
• user_principal_name: jane.smith@contoso.com
• display_name: Jane Smith
• password: ●●●●●●●●
Outputs:
• user_id: 5c3102ee-ec2e-4885-8959-32d739cb90fd
• user_principal_name: jane.smith@contoso.com
• password: TempPass123!
Parameter Resolution¶
Workflows intelligently resolve parameters:
Resolution Methods¶
Direct input from user
Automatic from environment
From earlier workflow steps
Parameter Flow Example¶
graph LR
A[User Input:<br/>email, name] --> B[Step 1:<br/>Create User]
B --> C[Output:<br/>user_id]
C --> D[Step 2:<br/>Assign License]
E[Context:<br/>tenant_id] --> B
E --> D
F[Defaults:<br/>usage_location] --> B
style A fill:#4285f4,color:#fff
style E fill:#f4b400,color:#000
style F fill:#34a853,color:#fff
style C fill:#fbbc04,color:#000
Workflow: Create User + Assign License
- User provides: email, display name
- Context provides: tenant_id (from ticket)
- Defaults provide: usage_location = "GB"
- Step 1 provides: user_id (for Step 2)
Workflow Validation¶
Before execution, workflows validate all parameters:
Validation Types¶
| Validation | Purpose | Example |
|---|---|---|
| Required Check | Ensures all required params present | user_email must be provided |
| Format Check | Validates parameter format | Email must be valid format |
| Existence Check | Verifies resources exist | User must exist for disable operation |
| Permission Check | Ensures you have access | Must have rights to assign licenses |
| Conflict Check | Detects problematic combinations | Can't assign license to disabled user |
Validation Errors¶
If validation fails, you'll see:
❌ Validation Failed
Parameter: user_email
Error: Invalid email format
Value: john.doe (missing domain)
Fix: Provide full email (john.doe@company.com)
Workflow will not execute until fixed.
Real-Time Progress¶
During execution, you see live updates via SignalR:
Progress Indicators¶
⏳ Workflow Running: M365 User Onboarding
✅ Step 1/3: Create M365 User - Completed (2.3s)
⏳ Step 2/3: Assign License - Running...
⏹️ Step 3/3: Add to Groups - Pending
Overall Progress: 33%
Elapsed Time: 5 seconds
Expandable Details¶
Click any step to see:
✅ Step 1: Create M365 User
📥 Inputs:
{
"tenant_id": "ca735f40...",
"user_principal_name": "jane.smith@contoso.com",
"display_name": "Jane Smith",
"password": "●●●●●●●●"
}
📤 Outputs:
{
"user_id": "5c3102ee-ec2e-4885-8959-32d739cb90fd",
"user_principal_name": "jane.smith@contoso.com",
"password": "TempPass123!",
"force_change_password_next_sign_in": true
}
⏱️ Duration: 2.3 seconds
✅ Status: Completed successfully
Error Handling¶
Workflows handle errors gracefully:
Error Behaviors¶
Error Messages¶
Detailed error information helps troubleshooting:
❌ Step 2 Failed: Assign License
Error Type: Graph API Error
Error Code: Request_BadRequest
Message: License assignment cannot be done for user with invalid usage location
Action: M365_AssignLicense
Step: Assign License
User: jane.smith@contoso.com
Suggestion: Ensure user has usage_location set. Run "Update User Details" first.
📚 Documentation: /docs/troubleshooting#license-assignment
Workflow Outputs¶
Successful workflows return useful data:
Output Types¶
| Output Type | Description | Example Use |
|---|---|---|
| Identifiers | Resource IDs created | user_id for future operations |
| Credentials | Passwords, keys | Temporary password for user |
| Status Info | Current state | License assignment status |
| Collections | Lists of items | All groups user was added to |
| Metadata | Additional info | Timestamp, executor |
Output Usage¶
You: Create user jane.smith@contoso.com
AI: ✅ Workflow completed!
Outputs:
• user_id: 5c3102ee-ec2e-4885-8959-32d739cb90fd
• password: TempPass123!
• display_name: Jane Smith
💡 Tip: Copy the password to share with the user securely.
You: Assign E3 license to that user
AI: Using user_id from previous workflow...
[Proceeds with jane.smith@contoso.com]
Outputs are remembered in the conversation context.
Common Workflow Patterns¶
Sequential Operations¶
Steps execute in order, each depending on previous:
Conditional Logic¶
Some workflows have conditional steps:
Parallel Execution¶
Some steps can run simultaneously (future feature):
Step 1a: Assign License 1 ┐
Step 1b: Assign License 2 ├─> All complete
Step 1c: Assign License 3 ┘
Step 2: Add to Groups
Best Practices¶
✅ Do This¶
Review Before Approving
✓ Check all parameters
✓ Verify correct tenant
✓ Confirm user/resource identifiers
✓ Review what will happen
Monitor Execution
Use Appropriate Workflows
✓ Use composite workflows for common tasks
✓ Chain individual workflows for custom needs
✓ Request new workflows for frequent operations
❌ Avoid This¶
Skipping Validation
Abandoning Failed Workflows
Misusing Workflows
✗ Using workflows for one-off manual changes
✗ Forcing workflows when simple action works
✗ Modifying sensitive parameters without understanding
Workflow vs. Manual Actions¶
When to use each:
| Scenario | Use Workflow | Use Manual Action |
|---|---|---|
| Common repeated task | ✅ | ❌ |
| Multi-step process | ✅ | ❌ |
| Needs validation/approval | ✅ | ❌ |
| One-time custom operation | ❌ | ✅ |
| Learning/exploring | ❌ | ✅ |
| Emergency quick fix | ❌ | ✅ |
Quick Reference¶
Workflow Lifecycle¶
Design: Draft → Review & Approval → Active
Execution: Trigger → Parameter Collection → Approval → Execution → Completion
Common Workflows Quick Access¶
| Type This | To Run This Workflow |
|---|---|
onboard jane.smith@company.com |
Complete user onboarding |
offboard john.doe@company.com |
Complete user offboarding |
reset password john.doe@company.com |
Password reset workflow |
create user jane@company.com |
User creation workflow |
assign license to john@company.com |
License assignment |
Next Steps¶
Learn more about workflows:
- Running Workflows - Step-by-step guide to executing workflows
- Workflow Review & Approval - Review process, notifications, and approval decisions
- Workflow History - Review past workflow executions
- Common Workflows - Detailed guide to frequently used workflows
- Creating Workflows - Build custom workflows
Workflows = Automation
Master workflows to automate 80% of repetitive IT tasks. The more you use them, the more time you save!