FlowDefinition stores a flow's definition-level description, label, and active version number. Its main operational role is selecting which version is active when a deployment includes the definition. It is separate from Flow metadata, which contains the flow implementation.
The active version is not necessarily the latest version. A definition can select an older version even when a newer deployed Flow has status set to Active.
Key Elements
| Element | What the Element Controls |
|---|---|
activeVersionNumber |
An integer selecting the active flow version. When the definition is deployed, this selection overrides the deployed flows' status fields. Community reports describe using 0 to deactivate a flow or process. |
description |
The description of the flow definition, rather than the flow's implementation. |
masterLabel |
The definition's label. In a managed package, it inherits the flow's active version name rather than acting as an independently maintained subscriber label. |
apiVersion |
An integer reserved for internal use. |
fullName |
The Metadata API component identity used to identify the definition and name its file. It is not the record ID used to address a Tooling API record. |
Behavior and Constraints
Salesforce recommends using Flow metadata, rather than FlowDefinition, to activate or deactivate flows. That recommendation does not change the precedence rule when a deployment includes a definition: FlowDefinition.activeVersionNumber overrides Flow.status.
For example, suppose the definition selects version 3, while the latest flow is version 4 with status set to Active. After deployment, version 3 is active. The definition does not mean "activate the latest version."
Version numbers need destination-org context. A 2021 deployment discussion warns that two orgs can have different numbers of versions for equivalent flow logic. Copying activeVersionNumber between orgs can therefore select a different implementation than intended.
In a managed package, masterLabel inherits the flow's active version name. To change that label in a subscriber org, edit the packaged flow name rather than treating masterLabel as a separate subscriber-maintained label.
Deployment and Retrieval
In a Metadata API package, definitions reside in the flowDefinitions directory. The filename matches the definition's unique full name and uses the .flowDefinition extension. For example, a definition named MyFlow has the filename MyFlow.flowDefinition.
FlowDefinition supports the wildcard * in package.xml. Use FlowDefinition as the manifest type when retrieving definitions; the definition is a separate file, not an element nested inside the Flow implementation.
A flow deployment does not generally need to include FlowDefinition merely to set activation status. If it does include the definition, account for its version selection as well as the deployed Flow.status values. The reported use of a definition-only deployment to deactivate a process is a specific deployment behavior, not a requirement to include definitions in every flow deployment.
Activation-only Tooling API operations are a different API operation from Metadata API deployment. A February 2023 example reports using HTTP PATCH on a Tooling API FlowDefinition record and setting its Metadata field to {"activeVersionNumber":0} to deactivate, or to a specific positive version number to activate that version. The request body wraps this value as {"Metadata":{"activeVersionNumber":0}}. This operation addresses the Tooling API record by its record ID, not a Metadata API component by fullName.
Relationships
Flow contains the implementation whose active version the definition selects. Translation entries and flow-based quick actions can also identify a definition. Those incoming references are not elements on FlowDefinition itself.
Referenced By
-
Translations:fullName. -
QuickAction:flowDefinition, for an action whosetypeisFlow.
Reported Issues
-
A copied version number can select different logic in the destination org. A 2021 Process Builder deployment discussion warns that version counts can differ between environments. Its consequence is that the same
activeVersionNumberis not a reliable identifier for equivalent logic across orgs. See the cross-org version-number warning. -
Deploying a draft may leave the existing active process running. The same 2021 discussion reports that deploying
Flowwithstatusset toDraftcreated a new inactive version without deactivating the existing active version. Deploying onlyFlowDefinitionwithactiveVersionNumberset to0was reported to deactivate the process. For the different operation of deploying a new active version throughFlow, the discussion points to Deploy processes and flows as active in Process Automation Settings. See the Process Builder deactivation report. -
A QuickAction error about a missing component may actually indicate an unresolved flow reference. In December 2022, a report associated
missing required field [Component]with aQuickActionoftypeFlowwhoseflowDefinitionreference could not resolve to the intended flow. Checking the referenced flow's identity and availability, including the deployed filenames, was reported to resolve the problem. The message did not necessarily mean the action XML needed aComponentelement. See the QuickAction flow-reference report. -
Changing activation through an API does not necessarily require deploying a metadata file. A February 2023 example reports activating and deactivating through a Tooling API
FlowDefinitionrecord'sMetadata.activeVersionNumber. It used0for deactivation and a specific positive number for activation. This is a record-ID-based Tooling API update, not afullName-based Metadata API deployment. See the Tooling API activation example.
Common Questions
What is the difference between Flow and FlowDefinition?
Flow contains the flow implementation. FlowDefinition holds definition-level information, including the active version number. They are separate metadata components, and Salesforce recommends using Flow metadata for activation and deactivation.
Why did deployment activate an older flow version?
If the deployment included FlowDefinition, its activeVersionNumber overrides the deployed flows' status fields. It can select an older version even when the latest deployed version has status set to Active.
Can I deactivate a flow without deploying another implementation version?
Community reports describe deploying only FlowDefinition with activeVersionNumber set to 0. A separate report describes a Tooling API PATCH that sets the record's Metadata.activeVersionNumber to 0. The Tooling API operation uses a record ID, not the component's fullName.
Why does a flow QuickAction deployment say "missing required field [Component]"?
A community report found that this message could mean the action's flowDefinition reference did not resolve to the intended flow. Check the referenced flow's identity and availability rather than assuming the action is missing a Component element.
How do I change a managed-package FlowDefinition label in a subscriber org?
Edit the packaged flow name. In a managed package, masterLabel inherits the flow's active version name rather than acting as an independent subscriber label.