ExpressionSetDefinition defines a versioned expression set used by Business Rules Engine and consuming industry solutions to evaluate rules, perform calculations, and execute configured business actions. It contains the versions, with each version holding its own steps and variables. The versions array must contain at least one ExpressionSetDefinitionVersion; steps and variables do not belong directly to the top-level definition.
An expression set is not necessarily just a calculation. Its steps can invoke business actions, look up decisions, branch on conditions, or call another expression set. Runtime version selection depends on status, effective dates, and rank together, not simply the highest version number.
Key Elements
| Element | What the Element Controls |
|---|---|
versions |
Contains the version definitions. At least one version is required. Each version requires label, startDate, status, and versionNumber. |
status |
Version status: Active, Draft, Inactive, InvalidDraft, or Obsolete. |
startDate, endDate
|
The version's availability period. startDate is required; endDate specifies when availability ends. |
rank, versionNumber
|
When multiple enabled versions match a call and their effective periods overlap, the highest rank wins. versionNumber identifies the version but does not alone determine selection. |
executionMode, executionScale
|
Definition-level execution settings. Mode supports Cloud and Local. Scale supports High and Low and describes the input scale that determines where execution occurs. These are separate settings. |
processType |
Identifies the business process using the rules. Choices are AssetRefreshEligibility, Bre, GpaCalculation, InsuranceClaimProcessing, ItServiceManagement, PlanCostCalculation, Program, RatingDiscovery, StockRotation, StudentInformationSystem, and StudentSuccess. Appears on the definition and its versions. |
interfaceSourceType |
Identifies the consuming cloud's customized builder, not the business process. Values are Bre, Constraint, DiscoveryProcedure, EventOrchestration, GpaCalculationProcedure, IntelligentDecisionStudio, ItServiceManagement, PricingProcedure, QualificationProcedure, RatingDiscoveryProcedure, RatingProcedure, and Sample. Appears on the definition and its versions. |
resourceInitializationType |
Controls whether variables and context tags initially contain null or default values. Supports Default and Off. |
stepType, actionType
|
stepType identifies the structural kind of step, such as Branch, Condition, DefaultPath, or SubExpression. actionType identifies the business action it executes. |
sequenceNumber, parentStep
|
Describe a step's sequence and placement within a version. Read them together: branches and nested steps cannot be interpreted as one flat sequence. parentStep names another step in the same version. |
variables |
Defines version resources. Each variable requires name, type, and dataType. collection indicates multiple values, and fields supports recursively nested sObject fields. |
lookupName, lookupType
|
On variables and nested fields, identify a decision matrix, decision table, or subexpression. Interpret the name with lookupType: DecisionMatrix, DecisionTable, or SubExpression. |
decimalScale, decimalPlaces
|
Version-level decimalScale controls decimal places in calculation-step results involving context variables. Variable and variable-field decimalPlaces describe decimal precision for currency, numeric, or percent values. |
shouldShowExplExternally |
Controls external visibility of decision explanations at version and step scope. The version-level default is false. |
resultIncluded |
Controls whether a step's output is included in the expression result. It does not control external visibility of the step's explanation. |
Behavior and Constraints
Version availability and consuming-solution settings
Evaluate a version's status, startDate, endDate, and rank together. The highest-rank rule applies when multiple enabled versions match the call and their effective periods overlap. A larger versionNumber does not override those selection rules.
A version's expressionSetDefinition identifies its parent definition by full name. This is a parent association, not an instruction to execute another expression set. Version-level uiTier indicates whether an API call originated from the design-time builder or a package and is for internal use only.
When Business Rules Engine is enabled, processType defaults to Bre. Other process types depend on the industry solution and permission sets available in the org. Check both definition-level and version-level processType and interfaceSourceType when interpreting the consuming-solution context.
Do not infer a one-to-one mapping between executionScale and executionMode from their names. Scale describes the inputs and determines where execution occurs, while mode separately specifies Cloud or Local.
The top-level label is required. The definition's template flag identifies whether it is a template, and its type supports Custom and Standard.
Steps, conditions, and parameter mappings
Each step requires label, name, sequenceNumber, and stepType. Structural kinds include advanced conditions, branches, business knowledge models, conditions, default paths, list operations, and subexpressions. Interpret sequenceNumber together with parentStep, rather than treating the XML as a flat execution list.
actionType can represent actions such as RunFlow, ApexAction, ApexListAction, Crud, UpsertRecord, and SendMail, as well as decision lookups, pricing, rating, and aggregation. Do not treat every business-knowledge-model step as a calculation.
A condition can use conditionExpression.expression directly. An advanced condition instead uses advancedCondition.conditionLogic with numbered criteria. Each criterion requires sequenceNumber, sourceFieldName, and operator. Its valueType distinguishes interpretations such as Formula, Literal, Lookup, and Parameter; the comparison text is not always a literal value.
Custom elements use customElement.parameters, while decision lookups and subexpressions use mappings to connect parameters. These mapping entries use ExpressionSetElementParameter. Its input and output flags are independent booleans, both required and both documented to default to true. They are not mutually exclusive directions. Its type defaults to Parameter and can also identify Formula, Literal, Lookup, or PickList values. These defaults do not establish defaults for the similarly named flags on version variables.
Resources and numeric results
A variable's type describes its resource role, such as Constant, Formula, Variable, or a context tag. Its dataType describes the value it holds. For example, ContextDynamicAttributeTag and ExecutableContextDefinitionTag are resource types, while Numeric and Sobject are data types. An sObject represents a Salesforce object; an Sobject variable can contain recursively nested fields.
A variable's value can hold a constant, a formula, or its default value; it is not necessarily literal input data. Its resultStep identifies the step that produces it. This is an internal data-flow link, not the name of a separate metadata component.
resourceInitializationType affects how null checks and calculations interpret newly initialized variables and context tags. Keep its null-versus-default behavior separate from decimal precision. Also keep version-level decimalScale separate from variable and nested-field decimalPlaces: they apply at different scopes.
Decision explanations and external visibility
Decision explanations are messages describing a decision, separate from the calculation result. Both versions and steps have shouldShowExplExternally, so both scopes matter when interpreting external exposure. The version-level default is false. Setting resultIncluded does not replace either visibility setting.
At step scope, shouldExposeConditionDetails controls whether condition details appear in the explanation. shouldExposExecPathMsgOnly limits template messages to the branch path that ran. hasNestedExplainability records whether the step has nested explainability.
passedExplainerTemplate, failedExplainerTemplate, and noResultExplainerTemplate provide messages for their corresponding outcomes. The corresponding passedMessageTokenMappings, failedMessageTokenMappings, and noResultMessageTokenMappings pair expressionSetMessageToken with resourceReference, connecting placeholders in the explanation text to resources.
Deployment and Retrieval
ExpressionSetDefinition extends Metadata and inherits its fullName field. Components use the .expressionSetDefinition suffix and reside in the expressionSetDefinition folder. The component contains its versions, with steps and variables nested inside those versions.
The type supports * in the package.xml manifest, the file that identifies components for deployment or retrieval. Use ExpressionSetDefinition as the manifest type name. See deploying and retrieving metadata with a ZIP file for the file-based manifest format.
Before deploying an expression set or expression set version to another org, review Salesforce's Expression Set Migration Considerations.
Deployment scope depends on the definition's actual decision-table, decision-matrix, subexpression, lookup, and object references, along with the destination's supported consuming solution and permissions. A possible relationship does not make every related metadata type a dependency of every expression set.
When diagnosing hand-authored metadata, distinguish component references from internal links. A version's parent association, a step's parentStep, and a variable's resultStep serve different purposes. Also check the spelling and structure differences listed below rather than relying on field-table descriptions alone.
Relationships
The principal component references occur inside versions. Decision steps can name decision matrices or tables, subexpression steps can invoke another expression set, and variables or recursively nested fields can contain lookups. objectName associates a modeled sObject with CustomObject metadata.
References
-
CustomObject:objectNameon variables and recursively nested fields. -
DecisionMatrixDefinition:decisionTableNameundersteps.decisionTable, andlookupNameon variables and nested fields. Interpret these with the decision step'stypeor the lookup'slookupType, respectively. -
DecisionTable:decisionTableNameundersteps.decisionTable, andlookupNameon variables and nested fields. Associated mappings connect the step's parameters. -
ExpressionSetDefinition:expressionSetundersteps.subExpression,lookupNameon variables and nested fields, and the version'sexpressionSetDefinition. The first two support composition or lookup; the last identifies the parent definition.
Referenced By
-
ExpressionSetDefinition:expressionSetfor subexpression steps,lookupNamefor subexpression lookups, andexpressionSetDefinitionfor a version's parent association. The parent association is not a runtime call.
Documentation Inconsistencies
Several field-table descriptions differ from the exposed element structure or Salesforce's XML example. These differences matter when interpreting or hand-authoring metadata:
-
Assignment and aggregation parameter names: The exposed structure uses
assignment.assignedParameterandaggregation.aggergatedParameter, including the latter spelling. Salesforce's XML example uses those names, but its field tables useaggregatedParameterfor both. -
Criterion values: The exposed criterion operator is
NotEquals, while the field table listsNoEquals. The exposed criterionvalueTypeusesPickList, while the criterion table listsPicklist. The custom-element parameter table also usesPickList. -
Message-token mapping structure: Passed, failed, and no-result token mappings are structured arrays, and Salesforce's XML example shows structured mapping elements. The field tables instead describe them as string enumerations. Each mapping pairs
expressionSetMessageTokenwithresourceReference. -
Industry-subtype spelling: The exposed element is
usageSubtype, while the field table spells itusageSubType. The documented default is null when unspecified. -
Process-type enumeration: The exposed
processTypeenumeration lists onlyBre. That is narrower than Salesforce's documented platform choices and must not be read as excluding the industry-specific process types listed above.
Common Questions
Which expression set version runs when effective dates overlap?
When multiple enabled versions match the call and their effective periods overlap, Salesforce selects the version with the highest rank. Status and effective dates also matter; versionNumber alone does not select the version.
How do I retrieve ExpressionSetDefinition metadata?
Use ExpressionSetDefinition in package.xml; the type supports the * wildcard. Components reside in the expressionSetDefinition folder and use the .expressionSetDefinition suffix.
Which dependencies must move with an expression set?
Follow its actual decision-matrix, decision-table, subexpression, lookup, and object references. Also account for the target org's consuming solution and permissions, and review Salesforce's migration considerations before deployment. Not every possible related type is a dependency of every definition.
Does resultIncluded make a decision explanation visible externally?
No. resultIncluded controls inclusion of step output in the expression result. External explanation visibility uses shouldShowExplExternally at version and step scope; the version-level default is false.
Why does expression set XML contain aggergatedParameter?
aggergatedParameter is the aggregation element spelling in the exposed structure and Salesforce's XML example. The field table instead lists aggregatedParameter. Assignment has a separate discrepancy: the exposed structure and XML example use assignedParameter.