Skip to main content

Workflow Best Practices

Guidelines for designing, implementing, and maintaining effective workflows.


Design Principles

Keep It Simple

WORKFLOW DESIGN PRINCIPLES
═══════════════════════════════════════════════════════════════════════════════

DO:
┌─────────────────────────────────────────────────────────────────────────────┐
│ ✓ Start with minimum viable workflow │
│ ✓ Add complexity only when needed │
│ ✓ Use clear, descriptive state names │
│ ✓ Document purpose of each state │
│ ✓ Handle all possible paths (approve, reject, timeout) │
│ ✓ Test thoroughly before releasing │
└─────────────────────────────────────────────────────────────────────────────┘

DON'T:
┌─────────────────────────────────────────────────────────────────────────────┐
│ ✗ Create too many states │
│ ✗ Add unnecessary conditions │
│ ✗ Use cryptic state or transition names │
│ ✗ Forget error handling paths │
│ ✗ Skip testing in sandbox │
└─────────────────────────────────────────────────────────────────────────────┘

State Naming Conventions

NAMING CONVENTIONS
═══════════════════════════════════════════════════════════════════════════════

State Names (Action-Oriented):
┌─────────────────────────────────────────────────────────────────────────────┐
│ GOOD │ AVOID │
├────────────────────────────────┼────────────────────────────────────────────┤
│ Pending Manager Approval │ State 1 │
│ Awaiting Director Review │ Mgr Apprvl │
│ Approved │ Done │
│ Rejected - Needs Revision │ Bad │
│ Escalated to Finance │ Finance │
└────────────────────────────────┴────────────────────────────────────────────┘

Transition Names (Verb-Based):
┌─────────────────────────────────────────────────────────────────────────────┐
│ GOOD │ AVOID │
├────────────────────────────────┼────────────────────────────────────────────┤
│ Submit for Approval │ Go │
│ Approve │ OK │
│ Reject │ No │
│ Escalate to Director │ Up │
│ Return for Revision │ Back │
└────────────────────────────────┴────────────────────────────────────────────┘

Error Handling

Always Provide Exit Paths

COMPLETE ERROR HANDLING
═══════════════════════════════════════════════════════════════════════════════

Every state should have a way out:

BAD Design (Dead End):
┌─────────────────────────────────────────────────────────────────────────────┐
│ │
│ ┌───────────┐ │
│ │ PENDING │ ─── [Approve] ───→ APPROVED │
│ │ APPROVAL │ │
│ └───────────┘ │
│ │
│ Problem: What if rejected? Record stuck forever! │
│ │
└─────────────────────────────────────────────────────────────────────────────┘

GOOD Design (All Paths Handled):
┌─────────────────────────────────────────────────────────────────────────────┐
│ │
│ ┌───────────┐ [Approve] ┌──────────┐ │
│ │ PENDING │ ────────────→ │ APPROVED │ │
│ │ APPROVAL │ └──────────┘ │
│ │ │ [Reject] ┌──────────┐ │
│ │ │ ────────────→ │ REJECTED │ ─[Resubmit]─→ PENDING │
│ │ │ └──────────┘ │
│ │ │ [2 Days] ┌──────────┐ │
│ │ │ ────────────→ │ ESCALATED│ │
│ └───────────┘ └──────────┘ │
│ │
│ All paths handled: approve, reject, timeout │
│ │
└─────────────────────────────────────────────────────────────────────────────┘

Handle Edge Cases

EDGE CASE HANDLING
═══════════════════════════════════════════════════════════════════════════════

Common Edge Cases:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Scenario │ Solution │
├─────────────────────────────────┼───────────────────────────────────────────┤
│ Approver is creator │ Add condition: approver != creator │
│ Record deleted in workflow │ Handle gracefully, don't error │
│ Required field empty │ Validate before submit transition │
│ Approver on vacation │ Auto-escalate with scheduled transition │
│ Amount changes after submit │ Re-route or restart workflow │
│ Multiple approvers needed │ Use custom fields to track each │
└─────────────────────────────────┴───────────────────────────────────────────┘

Performance Optimization

Minimize Actions

PERFORMANCE BEST PRACTICES
═══════════════════════════════════════════════════════════════════════════════

Keep workflows efficient:
┌─────────────────────────────────────────────────────────────────────────────┐
│ ✓ Limit entry actions (fewer = faster) │
│ ✓ Use conditions to skip unnecessary actions │
│ ✓ Avoid excessive email notifications │
│ ✓ Don't create records unless necessary │
│ ✓ Use custom scripts for complex logic (more efficient) │
└─────────────────────────────────────────────────────────────────────────────┘

Action Count Guidelines:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Entry Actions per State: 3-5 maximum │
│ Exit Actions per State: 1-2 maximum │
│ Transitions per State: 3-5 maximum │
│ Total States: 5-10 for most workflows │
└─────────────────────────────────────────────────────────────────────────────┘

Avoid Circular Paths

CIRCULAR PATH PREVENTION
═══════════════════════════════════════════════════════════════════════════════

BAD: Infinite loop possibility
┌─────────────────────────────────────────────────────────────────────────────┐
│ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ STATE A │ ─────→ │ STATE B │ ─────→ │ STATE C │ │
│ └───────────┘ └───────────┘ └───────────┘ │
│ ▲ │ │
│ │ │ │
│ └──────────────────────────────────────────┘ │
│ │
│ If conditions always match, workflow loops forever │
│ │
└─────────────────────────────────────────────────────────────────────────────┘

GOOD: Limit iterations or require user action
┌─────────────────────────────────────────────────────────────────────────────┐
│ │
│ Add counter field: custbody_revision_count │
│ Condition for return: {custbody_revision_count} < 3 │
│ │
│ After 3 revisions → Force to different state │
│ │
└─────────────────────────────────────────────────────────────────────────────┘

Testing Strategy

Testing Checklist

WORKFLOW TESTING CHECKLIST
═══════════════════════════════════════════════════════════════════════════════

Before Releasing:

☐ TEST ALL PATHS
☐ Happy path (approval)
☐ Rejection path
☐ Resubmission after rejection
☐ Timeout/escalation
☐ All conditional routes

☐ TEST WITH DIFFERENT ROLES
☐ Submitter role
☐ Approver role
☐ Admin role
☐ Role without access

☐ TEST EDGE CASES
☐ Minimum amount threshold
☐ Maximum amount threshold
☐ Empty optional fields
☐ Special characters in fields

☐ TEST EMAILS
☐ Correct recipients
☐ Correct content
☐ Links work
☐ Template renders correctly

☐ TEST SCHEDULED ACTIONS
☐ Reminders fire correctly
☐ Escalations work
☐ Conditions evaluated properly

☐ VERIFY AUDIT TRAIL
☐ State changes logged
☐ User actions captured
☐ Timestamps accurate

Using Test Mode

WORKFLOW RELEASE STATUS
═══════════════════════════════════════════════════════════════════════════════

Testing Mode:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Status: TESTING │
│ │
│ • Only applies to records marked as "Test" │
│ • Production data not affected │
│ • Use for initial development and validation │
│ │
│ To test: │
│ 1. Create test record │
│ 2. Check "Test" checkbox on record (if available) │
│ 3. Verify workflow initiates │
│ 4. Test all transitions │
└─────────────────────────────────────────────────────────────────────────────┘

Released Mode:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Status: RELEASED │
│ │
│ • Applies to all matching records │
│ • Use only after thorough testing │
│ • Monitor closely after release │
└─────────────────────────────────────────────────────────────────────────────┘

Suspended Mode:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Status: SUSPENDED │
│ │
│ • Workflow paused but not deleted │
│ • Existing instances continue │
│ • No new instances created │
│ • Use for emergency pause │
└─────────────────────────────────────────────────────────────────────────────┘

Troubleshooting

Common Issues

TROUBLESHOOTING GUIDE
═══════════════════════════════════════════════════════════════════════════════

ISSUE: Workflow doesn't start
┌─────────────────────────────────────────────────────────────────────────────┐
│ Possible Causes: │
│ • Release status is not "Released" │
│ • Initiation condition not met │
│ • Wrong record type selected │
│ • Trigger event not checked (Create/Update) │
│ │
│ Debug Steps: │
│ 1. Check workflow release status │
│ 2. Verify record type matches │
│ 3. Test initiation condition formula separately │
│ 4. Check trigger event settings │
└─────────────────────────────────────────────────────────────────────────────┘

ISSUE: Button doesn't appear
┌─────────────────────────────────────────────────────────────────────────────┐
│ Possible Causes: │
│ • Transition condition not met │
│ • User role doesn't have access │
│ • Record not in expected state │
│ • Button condition evaluates to false │
│ │
│ Debug Steps: │
│ 1. Check current workflow state on record │
│ 2. Verify transition conditions │
│ 3. Test with Administrator role │
│ 4. Check role restrictions on transition │
└─────────────────────────────────────────────────────────────────────────────┘

ISSUE: Action not executing
┌─────────────────────────────────────────────────────────────────────────────┐
│ Possible Causes: │
│ • Action has condition that's not met │
│ • Field value already matches (no change) │
│ • Error in formula or field reference │
│ • Custom action script has error │
│ │
│ Debug Steps: │
│ 1. Check action conditions │
│ 2. Verify field IDs are correct │
│ 3. Check workflow history for errors │
│ 4. Review script logs for custom actions │
└─────────────────────────────────────────────────────────────────────────────┘

ISSUE: Email not sending
┌─────────────────────────────────────────────────────────────────────────────┐
│ Possible Causes: │
│ • Recipient field is empty │
│ • Invalid email address │
│ • Email template error │
│ • Email preferences prevent sending │
│ │
│ Debug Steps: │
│ 1. Verify recipient field has value │
│ 2. Check recipient has valid email │
│ 3. Test email template separately │
│ 4. Check system email settings │
└─────────────────────────────────────────────────────────────────────────────┘

ISSUE: Scheduled action not firing
┌─────────────────────────────────────────────────────────────────────────────┐
│ Possible Causes: │
│ • Workflow moved to different state │
│ • Condition no longer met │
│ • System processing delay │
│ • Workflow suspended │
│ │
│ Debug Steps: │
│ 1. Verify record is still in expected state │
│ 2. Check scheduled action condition │
│ 3. Wait for system processing (can be delayed) │
│ 4. Check workflow status │
└─────────────────────────────────────────────────────────────────────────────┘

Monitoring Workflows

Workflow History

VIEWING WORKFLOW HISTORY
═══════════════════════════════════════════════════════════════════════════════

On Record:
┌─────────────────────────────────────────────────────────────────────────────┐
│ System Information subtab → Workflow History │
│ │
│ Shows: │
│ • Current workflow state │
│ • State entry timestamp │
│ • Previous states │
│ • Transition history │
└─────────────────────────────────────────────────────────────────────────────┘

Workflow Instances Report:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Customization → Workflow → Workflow Instances │
│ │
│ Filter by: │
│ • Workflow name │
│ • Current state │
│ • Date range │
│ • Record type │
└─────────────────────────────────────────────────────────────────────────────┘

Audit Trail

CREATING AUDIT TRAIL
═══════════════════════════════════════════════════════════════════════════════

Best Practice: Log all state changes to custom record

Custom Record: Workflow Audit Log
┌─────────────────────────────────────────────────────────────────────────────┐
│ Fields: │
│ • custrecord_log_record (link to source record) │
│ • custrecord_log_workflow (workflow name) │
│ • custrecord_log_from_state (previous state) │
│ • custrecord_log_to_state (new state) │
│ • custrecord_log_user (who triggered) │
│ • custrecord_log_datetime (when) │
│ • custrecord_log_comments (optional notes) │
└─────────────────────────────────────────────────────────────────────────────┘

Add "Create Record" action on each state entry to log transitions.

Documentation Template

WORKFLOW DOCUMENTATION TEMPLATE
═══════════════════════════════════════════════════════════════════════════════

# Workflow Name: [Invoice Approval Workflow]

## Purpose
[Brief description of what this workflow accomplishes]

## Record Type
[Vendor Bill / Sales Order / etc.]

## Trigger Conditions
- Initiates on: [Create / Update / Both]
- Condition: [Amount > $1,000]

## States

### State 1: [Pending Manager Approval]
- Purpose: [Wait for manager to review]
- Entry Actions:
- [Set status to "Pending"]
- [Email manager]
- [Lock record]
- Transitions:
- [Approve] → [Approved]
- [Reject] → [Rejected]
- [2 Days] → [Escalated]

### State 2: [Approved]
- Purpose: [Final approved state]
- Entry Actions:
- [Set status to "Approved"]
- [Email submitter]
- [Unlock record]

### State 3: [Rejected]
- Purpose: [Rejection with option to resubmit]
- Entry Actions:
- [Set status to "Rejected"]
- [Email submitter]
- Transitions:
- [Resubmit] → [Pending Manager Approval]

## Role Access
- [Manager]: Can approve/reject
- [Director]: Can approve/reject escalated
- [Submitter]: Can resubmit rejected

## Related Scripts
- [customscript_approval_action]: Custom logic for approval

## Change History
| Date | Change | By |
|------------|---------------------|-------------|
| 2024-01-15 | Initial creation | John Smith |
| 2024-02-01 | Added escalation | Jane Doe |

Next Steps

GoalGo To
Create custom action scriptsWorkflow Action Script →
View real-world examplesInvoice Approval Scenario →
Return to WorkflowsWorkflows Overview →