Workflows
Automate business processes by defining states, transitions, and actions that execute based on conditions.
What Are Workflows?
WORKFLOW AUTOMATION
═══════════════════════════════════════════════════════════════════════════════
┌─────────────────────────────────────────────────────────────────────────────┐
│ WORKFLOW CONCEPT │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ A workflow is a visual process definition that: │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ TRIGGERS │ → │ STATES │ → │ ACTIONS │ │
│ │ │ │ │ │ │ │
│ │ When record │ │ Where record │ │ What happens │ │
│ │ is created │ │ currently is │ │ at each step │ │
│ │ or updated │ │ in process │ │ │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ ↓ │
│ TRANSITIONS │
│ (How to move between states) │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
When to Use Workflows
| Use Case | Example | Why Workflow? |
|---|---|---|
| Approval processes | Invoice/PO routing | Multi-step, role-based approval |
| Status management | Order lifecycle | Visual state tracking |
| Notifications | Alert on changes | Automatic email triggers |
| Field updates | Auto-populate values | Consistent data rules |
| Record validation | Enforce requirements | Business rule compliance |
| Audit trails | Track changes | Automatic logging |
Workflow vs Script
WHEN TO USE EACH
═══════════════════════════════════════════════════════════════════════════════
CHOOSE WORKFLOW:
┌─────────────────────────────────────────────────────────────────────────────┐
│ ✓ Visual process flow needed │
│ ✓ Approval routing with multiple levels │
│ ✓ Status-based progression │
│ ✓ Non-developers need to modify │
│ ✓ Simple field updates and emails │
│ ✓ Button-triggered actions │
└─────────────────────────────────────────────────────────────────────────────┘
CHOOSE SCRIPT:
┌─────────────────────────────────────────────────────────────────────────────┐
│ ✓ Complex calculations needed │
│ ✓ External API calls required │
│ ✓ Line-level processing │
│ ✓ Dynamic record creation │
│ ✓ File operations │
│ ✓ Performance-critical operations │
└─────────────────────────────────────────────────────────────────────────────┘
COMBINE BOTH:
┌─────────────────────────────────────────────────────────────────────────────┐
│ ✓ Workflow manages states and routing │
│ ✓ Workflow Action Script for complex logic │
│ ✓ Best of both worlds │
└─────────────────────────────────────────────────────────────────────────────┘
Workflow Components
Core Elements
WORKFLOW STRUCTURE
═══════════════════════════════════════════════════════════════════════════════
┌─────────────────────────────────────────────────────────────────────────────┐
│ WORKFLOW DEFINITION │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ 1. INITIATION │
│ ──────────────────────────────────────────────────── │
│ • Record type (Sales Order, Invoice, etc.) │
│ • Trigger events (Create, Update, Scheduled) │
│ • Initiation conditions (When to start workflow) │
│ │
│ 2. STATES │
│ ──────────────────────────────────────────────────── │
│ • Define stages in the process │
│ • Each state has entry/exit actions │
│ • Records stay in state until transition occurs │
│ │
│ 3. TRANSITIONS │
│ ──────────────────────────────────────────────────── │
│ • Define how records move between states │
│ • Triggered by buttons, conditions, or schedules │
│ • Can have conditions and actions │
│ │
│ 4. ACTIONS │
│ ──────────────────────────────────────────────────── │
│ • Set field values │
│ • Send emails │
│ • Create/update records │
│ • Lock/unlock records │
│ • Run custom scripts │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Workflow Diagram Example
INVOICE APPROVAL WORKFLOW
═══════════════════════════════════════════════════════════════════════════════
┌──────────────────────────────────────────────────────────────────┐
│ WORKFLOW: Invoice Approval │
│ Record Type: Vendor Bill │
│ Trigger: On Create (Amount > $1,000) │
└──────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ STATE: PENDING │
│ │
│ Entry Actions: │
│ • Set status = "Pending Approval" │
│ • Lock record │
│ • Email approver │
└────────────────┬────────────────────────┘
│
┌────────────────┴────────────────┐
│ │
[Approve Button] [Reject Button]
│ │
▼ ▼
┌─────────────────────────┐ ┌─────────────────────────┐
│ STATE: APPROVED │ │ STATE: REJECTED │
│ │ │ │
│ Entry Actions: │ │ Entry Actions: │
│ • Set status │ │ • Set status │
│ • Set approved date │ │ • Unlock record │
│ • Set approved by │ │ • Email submitter │
│ • Unlock record │ │ │
│ • Email submitter │ │ Transitions: │
│ │ │ • [Resubmit] → PENDING │
│ (Final State) │ └─────────────────────────┘
└─────────────────────────┘
Creating a Workflow
Navigation
Customization → Workflow → Workflows → New
Basic Setup
WORKFLOW SETUP STEPS
═══════════════════════════════════════════════════════════════════════════════
Step 1: Define Workflow
┌─────────────────────────────────────────────────────────────────────────────┐
│ Name: Invoice Approval │
│ ID: custworkflow_invoice_approval (auto-generated) │
│ Description: Routes vendor bills for approval based on amount │
│ │
│ Owner: Finance Team │
│ Record Type: Vendor Bill │
│ Sub Types: (leave blank for all) │
└─────────────────────────────────────────────────────────────────────────────┘
Step 2: Set Triggers
┌─────────────────────────────────────────────────────────────────────────────┐
│ Initiate On: │
│ ☑ Create Start when record is created │
│ ☐ Update Start when record is updated │
│ ☐ View/Update Start when record is viewed or updated │
│ ☐ Scheduled Start on schedule │
│ │
│ Initiation Condition: │
│ Formula: {total} > 1000 │
│ (Only start workflow if amount exceeds $1,000) │
└─────────────────────────────────────────────────────────────────────────────┘
Step 3: Add States
┌─────────────────────────────────────────────────────────────────────────────┐
│ States in this workflow: │
│ │
│ ┌───────────────┐ │
│ │ Pending │ ← Initial state (first in list) │
│ │ Approval │ │
│ └───────────────┘ │
│ ┌───────────────┐ │
│ │ Approved │ ← Final state │
│ └───────────────┘ │
│ ┌───────────────┐ │
│ │ Rejected │ ← Can transition back to Pending │
│ └───────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
Step 4: Add Transitions
┌─────────────────────────────────────────────────────────────────────────────┐
│ Transitions from "Pending Approval": │
│ │
│ Transition Name │ Trigger │ To State │ Condition │
│ ───────────────────┼─────────────┼────────────┼───────────────────────── │
│ Approve │ Button │ Approved │ (none) │
│ Reject │ Button │ Rejected │ (none) │
│ │
│ Transitions from "Rejected": │
│ Resubmit │ Button │ Pending │ (none) │
└─────────────────────────────────────────────────────────────────────────────┘
Step 5: Add Actions to States
┌─────────────────────────────────────────────────────────────────────────────┐
│ "Pending Approval" Entry Actions: │
│ • Set Field: Status = "Pending Approval" │
│ • Lock Record │
│ • Send Email to Approver │
│ │
│ "Approved" Entry Actions: │
│ • Set Field: Status = "Approved" │
│ • Set Field: Approved Date = Today │
│ • Set Field: Approved By = Current User │
│ • Unlock Record │
│ • Send Email to Submitter │
└─────────────────────────────────────────────────────────────────────────────┘
Step 6: Test and Release
┌─────────────────────────────────────────────────────────────────────────────┐
│ Release Status: │
│ ○ Testing Only applies to test records │
│ ● Released Active in production │
│ ○ Suspended Temporarily disabled │
│ ○ Not Running Workflow is off │
└─────────────────────────────────────────────────────────────────────────────┘
Workflow Topics
| Topic | Description |
|---|---|
| States & Transitions → | Define workflow stages and movement |
| Actions → | What happens at each stage |
| Conditions & Formulas → | Control workflow logic |
| Scheduled Workflows → | Time-based automation |
| Best Practices → | Design and troubleshooting |
Quick Reference
Supported Record Types
Common record types for workflows:
- Transactions: Sales Order, Invoice, Purchase Order, Vendor Bill
- Entities: Customer, Vendor, Employee, Contact
- CRM: Opportunity, Case, Task, Event
- Custom Records: Any custom record type
Release Status
| Status | Description |
|---|---|
| Testing | Only runs on records marked as test |
| Released | Active for all matching records |
| Suspended | Temporarily paused |
| Not Running | Completely disabled |
Next Steps
| Goal | Go To |
|---|---|
| Design workflow states | States & Transitions → |
| Add workflow actions | Actions → |
| Use Workflow Action Scripts | Workflow Action Script → |