Skip to main content

Conditions & Formulas

Use conditions to control when workflows initiate, when transitions occur, and when actions execute.


Condition Types

WORKFLOW CONDITIONS
═══════════════════════════════════════════════════════════════════════════════

┌─────────────────────────────────────────────────────────────────────────────┐
│ INITIATION CONDITIONS │
│ ───────────────────── │
│ Control when workflow starts │
│ Example: Only start for invoices over $1,000 │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────────┐
│ TRANSITION CONDITIONS │
│ ───────────────────── │
│ Control when transitions are available │
│ Example: Only allow approval if all items have quantity > 0 │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────────┐
│ ACTION CONDITIONS │
│ ───────────────── │
│ Control when actions execute │
│ Example: Only send email to CFO if amount > $50,000 │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────────┐
│ BUTTON CONDITIONS │
│ ──────────────── │
│ Control when buttons appear │
│ Example: Only show Approve button to managers │
└─────────────────────────────────────────────────────────────────────────────┘

Formula Syntax

Basic Operators

FORMULA OPERATORS
═══════════════════════════════════════════════════════════════════════════════

COMPARISON OPERATORS:
┌─────────────────────────────────────────────────────────────────────────────┐
│ = Equal to │ {total} = 1000 │
│ != Not equal to │ {status} != 'Approved' │
│ > Greater than │ {total} > 5000 │
│ < Less than │ {quantity} < 10 │
│ >= Greater or equal │ {total} >= 1000 │
│ <= Less or equal │ {quantity} <= 100 │
└─────────────────────────────────────────────────────────────────────────────┘

LOGICAL OPERATORS:
┌─────────────────────────────────────────────────────────────────────────────┐
│ AND Both conditions true │ {total} > 1000 AND {status} = 'Pending' │
│ OR Either condition true │ {type} = 'A' OR {type} = 'B' │
│ NOT Negates condition │ NOT {isapproved} │
└─────────────────────────────────────────────────────────────────────────────┘

STRING OPERATORS:
┌─────────────────────────────────────────────────────────────────────────────┐
│ CONTAINS String contains │ {memo} CONTAINS 'urgent' │
│ STARTSWITH String starts │ {tranid} STARTSWITH 'PO-' │
│ ENDSWITH String ends │ {email} ENDSWITH '@company.com' │
│ IS EMPTY Field is empty │ {memo} IS EMPTY │
│ IS NOT EMPTY Field has value │ {approver} IS NOT EMPTY │
└─────────────────────────────────────────────────────────────────────────────┘

NULL CHECK:
┌─────────────────────────────────────────────────────────────────────────────┐
│ IS NULL Field is null │ {custbody_approver} IS NULL │
│ IS NOT NULL Field has value │ {custbody_approver} IS NOT NULL │
└─────────────────────────────────────────────────────────────────────────────┘

Field References

FIELD REFERENCE SYNTAX
═══════════════════════════════════════════════════════════════════════════════

CURRENT RECORD FIELDS:
┌─────────────────────────────────────────────────────────────────────────────┐
│ {fieldid} │ Field on current record │
│ {total} │ Transaction total │
│ {tranid} │ Transaction number │
│ {custbody_custom_field} │ Custom body field │
└─────────────────────────────────────────────────────────────────────────────┘

RELATED RECORD FIELDS (Joined):
┌─────────────────────────────────────────────────────────────────────────────┐
│ {entity.fieldid} │ Field on related entity │
│ {entity.companyname} │ Customer/Vendor name │
│ {entity.custentity_credit_limit}│ Custom entity field │
│ {salesrep.email} │ Sales rep's email │
└─────────────────────────────────────────────────────────────────────────────┘

SYSTEM FIELDS:
┌─────────────────────────────────────────────────────────────────────────────┐
│ {currentuser} │ Current user internal ID │
│ {currentuser.role} │ Current user's role │
│ {currentuser.department} │ Current user's department │
│ {today} │ Current date │
│ {now} │ Current date/time │
└─────────────────────────────────────────────────────────────────────────────┘

Initiation Conditions

When Workflow Starts

INITIATION CONDITION EXAMPLES
═══════════════════════════════════════════════════════════════════════════════

Amount-Based:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Condition: {total} > 1000 │
│ Meaning: Only start workflow for transactions over $1,000 │
└─────────────────────────────────────────────────────────────────────────────┘

Type-Based:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Condition: {type} = 'VendBill' │
│ Meaning: Only for Vendor Bills │
└─────────────────────────────────────────────────────────────────────────────┘

Department-Based:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Condition: {department} = 5 │
│ Meaning: Only for specific department (internal ID 5) │
└─────────────────────────────────────────────────────────────────────────────┘

Combined Conditions:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Condition: {total} > 5000 AND {department} = 5 │
│ Meaning: Over $5,000 AND in specific department │
└─────────────────────────────────────────────────────────────────────────────┘

XML Configuration:
<initcondition>
<formula>{total} > 1000 AND {type} = 'VendBill'</formula>
</initcondition>

Transition Conditions

Routing Logic

CONDITIONAL ROUTING
═══════════════════════════════════════════════════════════════════════════════

Route to different states based on conditions:

┌─────────────┐
│ DRAFT │
└──────┬──────┘

[Submit Button]

┌─────────────────────┼─────────────────────┐
│ │ │
{total} <= 5000 5000 < {total} <= 25000 {total} > 25000
│ │ │
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐
│ MANAGER │ │ DIRECTOR │ │ VP │
│ REVIEW │ │ REVIEW │ │ REVIEW │
└───────────┘ └───────────┘ └───────────┘

Transition Configurations:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Transition 1: Submit to Manager │
│ Condition: {total} <= 5000 │
│ To State: Manager Review │
│ │
│ Transition 2: Submit to Director │
│ Condition: {total} > 5000 AND {total} <= 25000 │
│ To State: Director Review │
│ │
│ Transition 3: Submit to VP │
│ Condition: {total} > 25000 │
│ To State: VP Review │
└─────────────────────────────────────────────────────────────────────────────┘

Validation Conditions

PREVENT TRANSITION IF INVALID
═══════════════════════════════════════════════════════════════════════════════

Only allow transition if data is valid:

┌─────────────────────────────────────────────────────────────────────────────┐
│ Transition: Approve │
│ Condition: {custbody_terms_accepted} = T │
│ │
│ Button only appears if terms checkbox is checked │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────────┐
│ Transition: Submit │
│ Condition: {memo} IS NOT EMPTY AND {custbody_justification} IS NOT EMPTY │
│ │
│ Require memo and justification before submission │
└─────────────────────────────────────────────────────────────────────────────┘

Role-Based Conditions

User Role Checks

ROLE-BASED ACCESS
═══════════════════════════════════════════════════════════════════════════════

Control based on current user's role:

┌─────────────────────────────────────────────────────────────────────────────┐
│ Condition: {currentuser.role} = 3 │
│ Meaning: Only for Administrator role (internal ID 3) │
└─────────────────────────────────────────────────────────────────────────────┘

Using Role Name (via saved search):
┌─────────────────────────────────────────────────────────────────────────────┐
│ Use Saved Search for role-based routing │
│ Search: Find records where approver role matches current user │
└─────────────────────────────────────────────────────────────────────────────┘

Button Visibility by Role:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Approve Button: │
│ Condition: {currentuser.role} IN (3, 15, 22) │
│ (Show to Admin, Manager, Director roles) │
│ │
│ Reject Button: │
│ Condition: {currentuser.role} IN (3, 15, 22) │
│ (Same roles can reject) │
│ │
│ Escalate Button: │
│ Condition: {total} > 50000 AND {currentuser.role} = 15 │
│ (Only managers can escalate high-value items) │
└─────────────────────────────────────────────────────────────────────────────┘

Date Conditions

Date Comparisons

DATE-BASED CONDITIONS
═══════════════════════════════════════════════════════════════════════════════

Current Date Comparisons:
┌─────────────────────────────────────────────────────────────────────────────┐
│ {duedate} < {today} │
│ Meaning: Due date is in the past (overdue) │
│ │
│ {duedate} = {today} │
│ Meaning: Due today │
│ │
│ {duedate} > {today} │
│ Meaning: Due in the future │
└─────────────────────────────────────────────────────────────────────────────┘

Date Arithmetic:
┌─────────────────────────────────────────────────────────────────────────────┐
│ {duedate} < {today} + 7 │
│ Meaning: Due within next 7 days │
│ │
│ {trandate} > {today} - 30 │
│ Meaning: Transaction within last 30 days │
└─────────────────────────────────────────────────────────────────────────────┘

Month/Year Conditions:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Use formulas for month/year extraction: │
│ MONTH({trandate}) = 12 │
│ YEAR({trandate}) = 2024 │
└─────────────────────────────────────────────────────────────────────────────┘

Saved Search Conditions

SAVED SEARCH CONDITIONS
═══════════════════════════════════════════════════════════════════════════════

Use saved search to define complex conditions:

┌─────────────────────────────────────────────────────────────────────────────┐
│ When to Use Saved Search: │
│ • Complex multi-field conditions │
│ • Conditions involving related records │
│ • Dynamic lists (e.g., high-risk customers) │
│ • Reusable condition logic │
└─────────────────────────────────────────────────────────────────────────────┘

Configuration:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Condition Type: Saved Search │
│ Search: customsearch_high_value_customers │
│ │
│ How it works: │
│ 1. Search runs with current record as context │
│ 2. If record appears in results, condition is TRUE │
│ 3. If record not in results, condition is FALSE │
└─────────────────────────────────────────────────────────────────────────────┘

Example Search: High Risk Orders
┌─────────────────────────────────────────────────────────────────────────────┐
│ Saved Search: customsearch_high_risk_orders │
│ │
│ Filters: │
│ • Type = Sales Order │
│ • Total > 10000 │
│ • Customer: Credit Hold = Yes │
│ │
│ Use in Workflow: │
│ • Route to Credit Review state if order matches search │
└─────────────────────────────────────────────────────────────────────────────┘

XML:
<condition>
<savedsearch>customsearch_high_risk_orders</savedsearch>
</condition>

Complex Condition Examples

Multi-Level Approval

COMPLEX ROUTING CONDITIONS
═══════════════════════════════════════════════════════════════════════════════

Purchase Order Approval Matrix:

┌──────────────────┬──────────────────┬────────────────────────────────────────┐
│ Amount Range │ Department │ Approval Required │
├──────────────────┼──────────────────┼────────────────────────────────────────┤
│ <= $1,000 │ Any │ Auto-approve │
│ $1,001 - $5,000 │ Any │ Manager │
│ $5,001 - $25,000 │ Any │ Director │
│ $25,001 - $50,000│ Any │ VP │
│ > $50,000 │ Any │ CFO │
│ Any amount │ Capital Projects │ Always requires VP │
└──────────────────┴──────────────────┴────────────────────────────────────────┘

Transition Conditions:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Auto-Approve: │
│ {total} <= 1000 AND {department} != 7 │
│ │
│ To Manager: │
│ {total} > 1000 AND {total} <= 5000 AND {department} != 7 │
│ │
│ To Director: │
│ {total} > 5000 AND {total} <= 25000 AND {department} != 7 │
│ │
│ To VP: │
│ ({total} > 25000 AND {total} <= 50000) OR {department} = 7 │
│ │
│ To CFO: │
│ {total} > 50000 │
└─────────────────────────────────────────────────────────────────────────────┘

Validation Before Submit

COMPREHENSIVE VALIDATION
═══════════════════════════════════════════════════════════════════════════════

Require all fields before allowing submission:

Condition for Submit Button:
┌─────────────────────────────────────────────────────────────────────────────┐
│ {custbody_justification} IS NOT EMPTY │
│ AND {custbody_cost_center} IS NOT NULL │
│ AND {memo} IS NOT EMPTY │
│ AND {total} > 0 │
│ AND {entity} IS NOT NULL │
└─────────────────────────────────────────────────────────────────────────────┘

If any field missing, Submit button won't appear.

Troubleshooting Conditions

COMMON CONDITION ISSUES
═══════════════════════════════════════════════════════════════════════════════

Issue: Condition never evaluates to TRUE
┌─────────────────────────────────────────────────────────────────────────────┐
│ Causes: │
│ • Field ID typo │
│ • Using display value instead of internal ID for lists │
│ • Null field not handled │
│ │
│ Fix: Test formula in Saved Search first │
└─────────────────────────────────────────────────────────────────────────────┘

Issue: Button appears but shouldn't
┌─────────────────────────────────────────────────────────────────────────────┐
│ Causes: │
│ • Condition logic reversed │
│ • Missing AND/OR operator │
│ • Parentheses missing in complex conditions │
│ │
│ Fix: Add parentheses for clarity: (A AND B) OR C │
└─────────────────────────────────────────────────────────────────────────────┘

Issue: Comparing text to number
┌─────────────────────────────────────────────────────────────────────────────┐
│ Wrong: {status} = Approved │
│ Right: {status} = 'Approved' │
│ │
│ Text values need quotes, numbers don't │
└─────────────────────────────────────────────────────────────────────────────┘

Next Steps

GoalGo To
Schedule workflowsScheduled Workflows →
Best practicesBest Practices →
Return to WorkflowsWorkflows Overview →