---
schema_version: "1"
id: f8309fb66cb61cda8d3315d40c627333ed9b8b432a3b0dc1fb632d946c6d2043
title: StageDefinition
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_stagedefinition.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_stagedefinition.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: b3126e484c172355db662840a6c345d9f20d9df96d37ba51564ef0453aa1af8e
description: Represents a collection of fields to set up the states and transitions for Stage Management.
---
# StageDefinition

Represents a collection of fields to set up the states and transitions for Stage Management.

## Parent Type

This type extends the [Metadata](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/metadata.htm) metadata type and inherits its fullName field.

## File Suffix and Directory Location

StageDefinition components have the suffix .stageDefinition and are stored in the stageDefinitions folder.

## Version

StageDefinition components are available in API version 62.0 and later.

## Fields

| Field Name | Description |
| --- | --- |
| active | 
Field Type

boolean

Description

Required. Indicates whether the stage definition is active (true) or not (false).





 |
| description | 

Field Type

string

Description

The description of the stage definition.



 |
| masterLabel | 

Field Type

string

Description

Required. A user-friendly name for stage definition, which is defined when the metadata component is created.





 |
| referenceObject | 

Field Type

string

Description

Required. The reference object associated with the stage definition.





 |
| referenceObjectField | 

Field Type

string

Description

Required. The name of the field in the reference object used to define stages.





 |
| referenceObjectRecordType | 

Field Type

string

Description

The record type of a reference object associated with the stage definition.



 |
| stageTransition | 

Field Type

[StageTransition\[\]](#StageTransition)

Description

A collection of fields to set up transitions between two states.



 |
| stageValue | 

Field Type

[StageValue\[\]](#StageValue)

Description

A collection of fields to set up the field values of an object for which stages are defined.



 |

## StageTransition

Represents a collection of fields to set up transitions between two states.

| Field Name | Description |
| --- | --- |
| criteria | 
Field Type

[StageCriteria\[\]](#StageCriteria)

Description

A collection of fields to set up the criteria for the object stage transition and object stage change.



 |
| customPermission | 

Field Type

string

Description

The custom permission associated with the stage transition. The custom permission required to initiate a stage change.



 |
| fromStageValue | 

Field Type

string

Description

Required. The From Stage that's associated with the referenced object's stage transition.





 |
| stepGroup | 

Field Type

[StgFulfillmentStepDefGrp\[\]](#StgFulfillmentStepDefGrp)

Description

A collection of fields to set up the stage fulfillment step definition.



 |
| toStageValue | 

Field Type

string

Description

Required. The To Stagethat's associated with the referenced object's stage transition.





 |
| userPermission | 

Field Type

StageUserPermission (enumeration of type string)

Description

Specifies the type of user permission needed to initiate a stage change.

Values are:

- CoordinateClinicalTrials
- CoordinateClnclTrialExprcUsr
- ManageClinicalTrials
- ParticipateClinicalTrials
- ProcessOrder





 |

## StageCriteria

Represents a collection of fields to set up the criteria for the object stage transition and object stage change.

| Field Name | Description |
| --- | --- |
| condition | 
Field Type

[StageCondition\[\]](#StageCondition)

Description

A collection of fields to set up the rules in transition criteria and stage change, including the object state, logic, and values.



 |
| criteriaType | 

Field Type

StageCriteriaType (enumeration of type string)

Description

Specifies the criteria type used to execute the transition.

Values are:

- AND
- CUSTOMLOGIC
- OR





 |
| errorMessage | 

Field Type

string

Description

A custom error message that's displayed when stage transition criteria evaluation fails.

Available in API version 64.0 and later.





 |
| executionType | 

Field Type

StageCriteriaExecType (enumeration of type string)

Description

Required. Specifies the type of logic used to execute the criteria.

Values are:

- CONDITION
- FLOW





 |
| flowDefinitionName | 

Field Type

string

Description

Specifies the developer name of the Flow that executes when the criteria execution type is set to FLOW.

Available in API version 63.0 and later.





 |
| isChildObject | 

Field Type

boolean

Description

Indicates whether the target object in the stage criteria represents a child object in a parent-child relationship (true) or not (false).

Available in API version 63.0 and later.





 |
| logicalExpression | 

Field Type

string

Description

Formula to specify custom logic. Compares the Criteria field to the Value field.





 |
| targetFieldName | 

Field Type

string

Description

Specifies the field name on the target object that's used in the stage transition criteria evaluation.

Available in API version 63.0 and later.





 |
| targetObject | 

Field Type

string

Description

Object that's used in a Parent-Child object relationship condition.





 |

## StageCondition

Represents a collection of fields to set up the rules in transition criteria and stage change, including the object state, logic, and values.

| Field Name | Description |
| --- | --- |
| operator | 
Field Type

StageConditionOperator (enumeration of type string)

Description

Required. Specifies the operator used in the transition criteria.

Values are:

- Contains
- DoesNotContain
- Equals
- GreaterOrEqual
- GreaterThan
- LessOrEqual
- LessThan
- NotEqualTo
- StartsWith





 |
| sequenceNumber | 

Field Type

int

Description

Required. Specifies the order of the object state transition condition in a sequence.





 |
| sourceField | 

Field Type

string

Description

Required. The object field to define filter conditions.





 |
| value | 

Field Type

string

Description

Required. Value of the field used in the transition criteria.





 |

## StgFulfillmentStepDefGrp

Represents a collection of fields to set up the stage fulfillment step definition.

| Field Name | Description |
| --- | --- |
| name | 
Field Type

string

Description

Required. The name of the stage fulfillment step definition group.





 |
| step | 

Field Type

[StgFulfillmentStepDef\[\]](#StgFulfillmentStepDef)

Description

A collection of fields to set up fullfillment step definitions for stages and transitions.



 |

## StgFulfillmentStepDef

Represents a collection of fields to set up fullfillment step definitions for stages and transitions.

| Field Name | Description |
| --- | --- |
| apiName | 
Field Type

string

Description

Required. The developer name of the stage fulfillment step definition.





 |
| assignedToQueue | 

Field Type

string

Description

The queue associated with the stage fulfillment step definition.



 |
| assignedToUser | 

Field Type

string

Description

The user associated with the stage fulfillment step definition.



 |
| dependency | 

Field Type

[StgFulfillmentStepDpndDef\[\]](#StgFulfillmentStepDpndDef)

Description

A collection of fields to set up the stage fulfillment step dependency between two steps.



 |
| executeOnRule | 

Field Type

string

Description

Specifies the expression set for the fulfillment step. The step is executed only when the corresponding expression set is set to true.

Available in API version 62.0 and later.





 |
| flowDefinitionName | 

Field Type

string

Description

The name of the flow added to the step definition.



 |
| integrationDefinitionName | 

Field Type

string

Description

The ID associated with the integration provider definition.



 |
| name | 

Field Type

string

Description

Required. The name of the stage fulfillment step definition.





 |
| omniscriptName | 

Field Type

string

Description

The name of the Omniscript defined in step definition.



 |
| runAsUser | 

Field Type

string

Description

The ID of the user associated with the step definition. The user required to execute the step definition.



 |
| stepType | 

Field Type

string

Description

Required. Specifies the type of fulfillment step.





 |

## StgFulfillmentStepDpndDef

Represents a collection of fields to set up the stage fulfillment step dependency between two steps.

| Field Name | Description |
| --- | --- |
| step | 
Field Type

string

Description

Required. The step definition for the fulfillment step.





 |

## StageValue

Represents a collection of fields to set up the field values of an object for which stages are defined.

| Field Name | Description |
| --- | --- |
| criteria | 
Field Type

[StageCriteria\[\]](#StageCriteria)

Description

A collection of fields to set up the criteria for the object stage transition and object stage change.



 |
| stepGroup | 

Field Type

[StgFulfillmentStepDefGrp\[\]](#StgFulfillmentStepDefGrp)

Description

A collection of fields to set up the stage fulfillment step definition.



 |
| value | 

Field Type

string

Description

Required. The value of the field used in the transition criteria.





 |

## Declarative Metadata Sample Definition

The following is an example of a StageDefinition component.

<?xml version="1.0" encoding="UTF-8"?>
<StageDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
    <active\>false</active\>
    <description\>Application form Stage transitions</description\>
    <masterLabel\>basic</masterLabel\>
    <referenceObject\>ApplicationForm</referenceObject\>
    <referenceObjectField\>Stage</referenceObjectField\>
    <stageTransition\>
        <criteria\>
            <condition\>
                <operator\>Equals</operator\>
                <sequenceNumber\>1</sequenceNumber\>
                <sourceField\>ApplicationForm.Name</sourceField\>
                <value\>test</value\>
            </condition\>
            <criteriaType\>AND</criteriaType\>
            <executionType\>CONDITION</executionType\>
            <logicalExpression\>1</logicalExpression\>
            <targetObject\>ApplicationForm</targetObject\>
        </criteria\>
        <userPermission\>ProcessOrder</userPermission\>
        <fromStageValue\>Initiated</fromStageValue\>
        <toStageValue\>On Hold</toStageValue\>
        <stepGroup\>
            <name\>Initiated-On Hold</name\>
            <step\>
                <apiName\>Autotask\_step\_defn</apiName\>
                <flowDefinitionName\>disputemanagement\_\_InvokeAsyncAction</flowDefinitionName\>
                <name\>Autotask step defn</name\>
                <runAsUser\>testuser@salesforce.com</runAsUser\>
                <stepType\>AutoTask</stepType\>
            </step\>
            <step\>
                <apiName\>testScreenFlow</apiName\>
                <assignedToUser\>testuser@salesforce.com</assignedToUser\>
                <flowDefinitionName\>cms\_orch\_\_CMS\_NotifyRequester</flowDefinitionName\>
                <name\>testScreenFlow</name\>
                <stepType\>ManualTask</stepType\>
                <dependency\>
                   <step\>Autotask\_step\_defn</step\>
                </dependency\>
            </step\>
        </stepGroup\>
    </stageTransition\>
    <stageValue\>
        <value\>Initiated</value\>
        <criteria\>
            <condition\>
                <operator\>Equals</operator\>
                <sequenceNumber\>1</sequenceNumber\>
                <sourceField\>ApplicationForm.Name</sourceField\>
                <value\>test</value\>
            </condition\>
            <criteriaType\>AND</criteriaType\>
            <executionType\>CONDITION</executionType\>
            <logicalExpression\>1</logicalExpression\>
            <targetObject\>ApplicationForm</targetObject\>
        </criteria\>
        <stepGroup\>
            <name\>Initiated</name\>
            <step\>
                <apiName\>Autotask\_step\_defn</apiName\>
                <flowDefinitionName\>disputemanagement\_\_InvokeAsyncAction</flowDefinitionName\>
                <name\>Autotask step defn</name\>
                <runAsUser\>testuser@salesforce.com</runAsUser\>
                <stepType\>AutoTask</stepType\>
            </step\>
            <step\>
                <apiName\>testScreenFlow</apiName\>
                <assignedToUser\>testuser@salesforce.com</assignedToUser\>
                <flowDefinitionName\>cms\_orch\_\_CMS\_NotifyRequester</flowDefinitionName\>
                <name\>testScreenFlow</name\>
                <stepType\>ManualTask</stepType\>
                <dependency\>
                    <step\>Autotask\_step\_defn</step\>
                </dependency\>
            </step\>
        </stepGroup\>
    </stageValue\>
    <stageValue\>
        <value\>On Hold</value\>
    </stageValue\>
</StageDefinition\>

The following is an example package.xml that references the previous definition.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <members\>\*</members\>
        <name\>StageDefinition</name\>
    </types\>
    <version\>62.0</version\>
</Package\>

## Wildcard Support in the Manifest File

This metadata type supports the wildcard character \* (asterisk) in the package.xml manifest file. For information about using the manifest file, see [Deploying and Retrieving Metadata with the Zip File](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/file_based_zip_file.htm "HTML (New Window)").