WorkflowRule defines object-scoped automation that evaluates record conditions and starts immediate or time-based workflow actions. It controls the rule's criteria, activation state, evaluation mode, and schedules. It is a child of the object-level Workflow container, under rules.
A rule references actions; it does not contain their implementations. Email recipients, field-update operations, outbound message endpoints, and flow inputs belong to separate workflow action components. Also distinguish the object's Workflow identity from an individual rule's fullName.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The rule's API identity. The formal definition specifies a developer name, but individual-rule manifest naming has a documented ambiguity described below. |
active |
Required Boolean that determines whether the rule is enabled. Matching criteria alone do not make an inactive rule run. |
triggerType |
Controls eligible evaluation events. onCreateOnly considers creation only; onAllChanges considers all changes; onCreateOrTriggeringUpdate considers creation and updates that cause the record to meet the criteria. OnRecursiveUpdate is also exposed, without published execution semantics. |
criteriaItems |
Structured conditions using field, operation, and value or valueField. Either criteriaItems or formula must be supplied. |
booleanFilter |
Combines numbered criteria items, for example (1 AND 2) OR 3. It controls the logic between conditions, not when the rule is evaluated. |
formula |
A Boolean condition supplied instead of structured criteria. Field dependencies can be embedded in the formula text. |
actions |
References to immediate actions. Each entry requires name and type; the action definition is stored separately. |
workflowTimeTriggers |
Groups scheduled action references with their date basis and time offset. |
workflowTimeTriggers.actions |
References to actions executed by a time trigger. These use the same name and type structure as immediate actions. |
workflowTimeTriggers.offsetFromField |
The date or date/time field used as the scheduling basis. |
workflowTimeTriggers.timeLength |
The offset, stored as numeric text. Negative values mean before the date basis; positive values mean after it. |
workflowTimeTriggers.workflowTimeTriggerUnit |
The offset unit: Hours or Days. |
failedMigrationToolVersion |
Records the version associated with a failed migration attempt for administrative follow-up and retry planning. It is not a runtime API-version setting. |
Behavior and Constraints
Evaluation events and matching conditions are separate
An active rule needs both an eligible evaluation event and matching conditions. For example, a record can currently satisfy a rule's criteria without an edit qualifying under onCreateOrTriggeringUpdate. Check triggerType separately from criteriaItems or formula when diagnosing a rule that does not fire.
Structured criteria support operations including equals, notEqual, contains, notContain, startsWith, includes, excludes, greaterThan, greaterOrEqual, lessThan, lessOrEqual, and within. Use booleanFilter to express the intended combination of numbered conditions. A formula supplies the Boolean condition directly.
Field updates control additional evaluation
Additional workflow evaluation is configured on WorkflowFieldUpdate, not on WorkflowRule. When a referenced field update has reevaluateOnChange=true and actually changes the field's value, workflow rules on the associated object are reevaluated. Rules whose criteria are met as a result can trigger.
If those rules cause further field updates that also enable reevaluation, the cascade can continue up to five times after the initial field update. Do not interpret triggerType=OnRecursiveUpdate as a substitute for WorkflowFieldUpdate.reevaluateOnChange; its execution semantics are not defined in the published rule definition.
Immediate actions and scheduled actions are distinct
Entries in actions identify immediate actions. Entries in workflowTimeTriggers.actions identify scheduled actions. In both places, name identifies the action and type identifies its category. Inspect both locations to determine what the rule does and when.
Recognized action destinations include WorkflowAlert, WorkflowFieldUpdate, WorkflowFlowAction, WorkflowKnowledgePublish, WorkflowOutboundMessage, and WorkflowTask. An action reference does not contain the action's implementation.
Flow-trigger actions have an org prerequisite
To continue creating and editing FlowAction workflow actions, the org must already have the closed flow-trigger pilot enabled. The presence of FlowAction in an enumeration does not establish that an org can use it.
Flow-trigger test mode is not supported through Metadata API. If administrators need the trigger to run the latest flow version when they cause the rule to fire, enable test mode through the user interface after deployment.
Deployment and Retrieval
Use Workflow to retrieve the object-level workflow configuration. In a manifest, an object API name such as Opportunity selects that object's container. A Workflow entry with members set to * retrieves all workflow containers.
Metadata API workflow files use the .workflow suffix and reside in the workflows directory. There is one file per standard or custom object that has workflow. The container holds rule definitions and separately defined actions under elements such as rules, alerts, and fieldUpdates.
Individual-rule manifest examples use the form ObjectApiName.RuleName, with a period separator, under type WorkflowRule. For example, Opportunity.Update_Field_On_Condition identifies a rule rather than the entire Opportunity workflow container. Use the retrieved component identity rather than assuming that a UI label and developer name are interchangeable.
Retrieving or examining a rule alone does not describe all of its effects. Follow its immediate and scheduled action references to their definitions. For an email alert, for example, WorkflowAlert.template identifies an EmailTemplate. The template need not be in the deployment ZIP, but it must exist in Metadata API.
Tooling API activation updates need more than the activation flag. A 2021 report warns that submitting only active inside Metadata can clear omitted values, such as description, or fail because expected metadata structures are missing. The reported approach is to read the rule's complete Metadata, change only active, and resubmit it. Retain the original activation state if the rule must later be restored.
The same report says that selecting the Tooling API Metadata field requires retrieving one rule at a time. This restriction concerns Tooling API queries; it does not limit an object-level Metadata API Workflow retrieval to one rule.
Relationships
A rule's direct dependencies are fields used in conditions or schedules and the actions identified by its action references. The Workflow container is its parent through rules. That containment and object-scoped identity are distinct from the element references listed below.
References
-
CustomField:criteriaItems.field,criteriaItems.valueField,formula,workflowTimeTriggers.offsetFromField. Formula references are embedded in text rather than exposed as separate reference elements. -
WorkflowAlert:actions.name,workflowTimeTriggers.actions.name. -
WorkflowFieldUpdate:actions.name,workflowTimeTriggers.actions.name. -
WorkflowFlowAction:actions.name,workflowTimeTriggers.actions.name. -
WorkflowKnowledgePublish:actions.name,workflowTimeTriggers.actions.name. -
WorkflowOutboundMessage:actions.name,workflowTimeTriggers.actions.name. -
WorkflowTask:actions.name,workflowTimeTriggers.actions.name.
Referenced By
-
Flow:migratedFromWorkflowRuleName.
Dependencies continue beyond these direct references. WorkflowAlert.template references an EmailTemplate, while WorkflowFlowAction.flow identifies the Flow launched by the action. Changes to those components can change a rule's effects without changing its criteria or action references. Recipient configuration, field-update operations, outbound endpoints, and flow inputs belong to the corresponding action definitions.
The incoming Flow.migratedFromWorkflowRuleName association records migration lineage. It is separate from the outgoing execution path through WorkflowFlowAction. Migration lineage alone does not establish whether the original rule or replacement flow is active.
Documentation Inconsistencies
-
Rule identity is ambiguous across the formal definition and manifest reports. The formal
fullNamedefinition allows only alphanumeric characters and underscores, requires an initial letter, and prohibits spaces, a trailing underscore, and consecutive underscores. A 2019 manifest report instead says that the rule portion can require the label with URL-encoded special characters. Other examples in that discussion call it the API/developer name. The encoding report concerns manifest member naming, not metadata-file encoding. -
The published trigger list does not explain every exposed value. The rule definition documents
onAllChanges,onCreateOnly, andonCreateOrTriggeringUpdate. The exposed enumeration also containsOnRecursiveUpdate, without defined execution semantics. -
The published action-reference list is narrower than the exposed enumeration. The
WorkflowActionReferencedefinition listsAlert,FieldUpdate,FlowAction,OutboundMessage, andTask. The exposed enumeration additionally containsFlowAutomation,KnowledgePublish,Notification, andSend. Enumeration presence alone does not establish feature availability in an org.
Reported Issues
-
Wildcard retrieval of child types returned no workflow components in a command-line report. In 2020, a manifest containing wildcard entries for
WorkflowAlert,WorkflowFieldUpdate, andWorkflowRuleretrieved other metadata but omitted those components. The accepted answer used the object-levelWorkflowcontainer to retrieve them. Wildcard retrieval discussion. -
A successful single-rule retrieve did not guarantee a successful single-rule deployment. In a 2021 command-line report, deploying
WorkflowRule:ObjectApiName.RuleNamefailed with a message that the member was not found in the zipped directory. The accepted workaround deployed the object's.workflow-meta.xmlfile by path. This is reported command-line behavior, not a general prohibition on individual-rule manifests. Single-rule deployment discussion. - A rule's label and developer name may not be interchangeable in a manifest. A 2019 answer reported needing the rule label, with special characters URL-encoded, while other answers used developer-name examples. Use the retrieved identity to resolve this naming discrepancy rather than applying URL encoding to the metadata file itself. Manifest naming discussion.
-
An activation-only Tooling API update can lose other metadata or fail. A 2021 report recommended reading and resubmitting the complete rule metadata with only
activechanged. It also reported that selectingMetadatarequires one rule per query and advised retaining original activation states for later restoration. Tooling API activation discussion. -
Currency-typed entry criteria blocked a reported migration, but multicurrency alone did not. In July 2022, a Migrate to Flow test reproduced failure when a currency-typed field such as Amount appeared in entry criteria in a multicurrency org. A criterion using
CurrencyIsoCodemigrated. This was a conditional migration-tool finding, not a blanket restriction on multicurrency orgs. Multicurrency migration discussion. - Loop-shaped immediate field updates did not repeatedly fire the same rules in reported tests. In 2019, a three-rule test with reevaluation enabled fired each rule once, even though the final field update met the first rule's criteria again. This conditional result helps distinguish immediate reevaluation from assumptions about unlimited recursion. Workflow reevaluation discussion.
Common Questions
How do I retrieve all workflow rules for an object?
Retrieve the object's Workflow container using its object API name as the manifest member. To retrieve all workflow containers, use * under Workflow. The resulting object-level file contains rules and action definitions.
Why does my workflow rule match the record but not fire?
Check both active and triggerType. A matching condition is separate from an eligible evaluation event. In particular, onCreateOrTriggeringUpdate considers updates that cause the record to meet the criteria, not every edit while the criteria remain true.
Where are time-based workflow actions defined?
The rule stores schedules in workflowTimeTriggers, including the date basis, signed offset, and Hours or Days unit. Its scheduled actions entries reference separately defined workflow action components.
Can I deactivate a workflow rule by updating only active through Tooling API?
A reported Tooling API issue warns against sending only active inside Metadata. Read the complete metadata, change only the activation flag, and resubmit the structure. Preserve the original state if you intend to restore it later.
Does enabling multicurrency prevent workflow migration to Flow?
Not as a blanket conclusion. The July 2022 report distinguished currency-typed entry criteria, which failed in the reported multicurrency test, from a CurrencyIsoCode criterion, which migrated.