What This Table Is
The wf_workflow table stores definitions for legacy Workflow processes that were the primary automation tool before Flow Designer. Each record represents a complete workflow definition including its activities, transitions, and variables. These workflows operate on a graphical flowchart model where activities are connected by transitions with conditions.
The Workflow module owns this table and supports end-to-end process automation through visual workflow design. Workflows can be triggered by database operations, scheduled events, or manual execution. They're particularly common in HR processes, approval chains, and complex IT service management scenarios where Flow Designer wasn't available or suitable.
This table doesn't extend any parent table and isn't extended by child tables. However, it has a complex relationship with wf_activity, wf_transition, and wf_context tables that define the workflow's structure and execution state. Workflow execution creates records in wf_executing to track running instances.
Enterprise instances typically have 50-200 workflow definitions, but record volume is low since this table only stores definitions, not executions. Performance is generally good, though workflows with many activities or complex conditions can impact execution performance rather than query performance on this table.
When You'll Script Against This Table
Developers typically script against wf_workflow in Script Includes that manage workflow lifecycle, Business Rules that trigger workflows programmatically, and Scheduled Jobs that start workflows on schedule. Most workflow interaction happens through the Workflow Script Include rather than direct table queries.
Access is controlled by the workflow_admin role for write operations and itil role for read operations. Most developers work in global scope when scripting workflows, though scoped applications can contain their own workflow definitions.
Common scripting patterns:
- Starting workflows programmatically using
workflow.startFlow()with the workflow sys_id - Querying active workflows for specific tables to understand automation coverage
- Checking workflow published state before attempting to execute
- Building workflow management utilities that activate/deactivate workflows in bulk
- Creating reports on workflow usage by table and trigger conditions
- Cloning workflows programmatically for similar processes across different tables
- Auditing workflow configuration changes for compliance and troubleshooting
Table Gotchas
The 'published' field is a string ('true'/'false'), not a boolean. Many developers expect workflow.published == true but must use workflow.published == 'true' instead.
Workflows can appear active but still not execute if they're unpublished. Always check both active=true AND published='true' before expecting execution.
- The
tablefield stores the target table name, but workflows can operate on multiple tables through their activities. Don't assume thetablefield represents all tables the workflow touches. - Workflow execution doesn't create records in this table - it creates records in
wf_executing. Querywf_executingfor runtime information, notwf_workflow.
Deleting workflow records doesn't clean up related wf_activity, wf_transition, or wf_executing records automatically. Use the workflow designer's delete function instead of direct record deletion.
- The
conditionfield uses encoded query syntax, not JavaScript. Parse it withGlideRecord.addEncodedQuery()if you need to understand trigger conditions programmatically. - Workflow versioning isn't automatic. The
versionfield is manually managed and doesn't increment on changes like Flow Designer versions do.
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.
Related Tables
The wf_activity table stores individual workflow steps and references this table through its workflow field. Each workflow can have dozens of activities. The wf_transition table defines the connections between activities and also references workflows. These three tables form the core workflow definition structure.
Runtime execution creates records in wf_executing which references both this table and the target record being processed. The wf_context table stores variable definitions and current values during execution. Developers commonly join these tables when building workflow monitoring or debugging utilities.
The sys_metadata table tracks workflow customizations and update set inclusion. Since workflows are complex objects with many related records, developers often query metadata when managing workflow deployments across instances.