StageAssignment
Parent Type
File Suffix and Directory Location
StageAssignment components have the suffix .stageAssignment and are stored in the stageAssignments folder.
Version
StageAssignment components are available in API version 64.0 and later.
Fields
| Field Name | Description |
|---|---|
| active |
|
| description |
|
| masterLabel |
|
| referenceObject |
|
| referenceObjectRecordType |
|
| ruleCriteria |
|
| stageDefinition |
|
StgAssignmentRuleCriteria
Represents a collection of fields to define rule criteria for stage definition assignment. Rule criteria are evaluated in priority order, with lower priority numbers evaluated first.
| Field Name | Description |
|---|---|
| condition |
|
| criteriaType |
|
| logicalExpression |
|
| name |
|
| priority |
|
| stageDefinition |
|
StgAssignmentRuleCond
Represents a collection of fields to define individual condition rules for stage assignment rule criteria. Each condition compares a field value against a specified value using a comparison operator.
| Field Name | Description |
|---|---|
| fieldName |
|
| operator |
|
| sequenceNumber |
|
| value |
|
Usage
StageAssignment works in conjunction with StageDefinition to provide automated stage management. While StageDefinition defines the stages, transitions, and workflows, StageAssignment determines which stage definition to apply to a record based on rule criteria.
Evaluation Process:
- When a record is created or updated, the system evaluates active StageAssignment rules for the object.
- Rule criteria are evaluated in priority order where lower numbers have higher priority.
- The first rule criteria that evaluates to true determines the stage definition assignment.
- If no rule criteria matches, the default stageDefinition from the StageAssignment is used.
- The assigned stage definition governs the stage behavior for that record.
Use Cases:
- Value-based Assignment—Assign different stage definitions based on transaction amounts. For example, premium stages for high-value applications.
- Type-based Assignment—Use different stage workflows for different record types.
- Status-based Assignment—Apply specific stage definitions based on record status or classification.
- Complex Criteria—Combine multiple conditions to create sophisticated assignment rules.
Declarative Metadata Sample Definition
The following is an example of a StageAssignment component.
1<?xml version="1.0" encoding="UTF-8"?>
2<StageAssignment xmlns="http://soap.sforce.com/2006/04/metadata">
3 <active>true</active>
4 <description>Assigns stage definitions to applications based on amount</description>
5 <masterLabel>Application Stage Assignment</masterLabel>
6 <referenceObject>ApplicationForm</referenceObject>
7 <ruleCriteria>
8 <name>High Value Applications</name>
9 <priority>1</priority>
10 <criteriaType>AND</criteriaType>
11 <condition>
12 <fieldName>Amount</fieldName>
13 <operator>GreaterThan</operator>
14 <sequenceNumber>1</sequenceNumber>
15 <value>10000</value>
16 </condition>
17 <condition>
18 <fieldName>Status</fieldName>
19 <operator>Equals</operator>
20 <sequenceNumber>2</sequenceNumber>
21 <value>Approved</value>
22 </condition>
23 <stageDefinition>Premium_Application_Stages</stageDefinition>
24 </ruleCriteria>
25 <ruleCriteria>
26 <name>Standard Applications</name>
27 <priority>2</priority>
28 <criteriaType>AND</criteriaType>
29 <condition>
30 <fieldName>Amount</fieldName>
31 <operator>LessOrEqual</operator>
32 <sequenceNumber>1</sequenceNumber>
33 <value>10000</value>
34 </condition>
35 <stageDefinition>Standard_Application_Stages</stageDefinition>
36 </ruleCriteria>
37 <stageDefinition>Basic_Application_Stages</stageDefinition>
38</StageAssignment>The following is an example package.xml that references the previous definition.
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3 <types>
4 <members>*</members>
5 <name>StageAssignment</name>
6 </types>
7 <version>64.0</version>
8</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.