StageDefinition

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

Parent Type

This type extends the Metadata 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[]
Description
A collection of fields to set up transitions between two states.
stageValue
Field Type
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[]
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[]
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[]
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

Required. Specifies the criteria type used to execute the transition.

Values are:

  • AND
  • CUSTOMLOGIC
  • OR
executionType
Field Type
StageCriteriaExecType (enumeration of type string)
Description

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

Values are:

  • CONDITION
logicalExpression
Field Type
string
Description

Required. Formula to specify custom logic. Compares the Criteria Field to the Value Field.

targetObject
Field Type
string
Description

Required. The object 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[]
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[]
Description
A collection of fields to set up the stage fulfillment step dependency between two steps.
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[]
Description
A collection of fields to set up the criteria for the object stage transition and object stage change.
stepGroup
Field Type
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.