Constraints enforce rules and conditions on types, variables, and relationships. Use constraints to define logical restrictions and ensure consistency within the model.
Every variable in a configuration carries a cfgStatus value that records how its current value was set. The constraint engine uses cfgStatus to decide whether it can change a variable’s value while solving. A variable’s cfgStatus is one of these values.
User A user manually set the value during configuration. The constraint engine treats this value as fixed.
Default A setDefault or preference rule set the value. The constraint engine can override this value while solving.
Engine The constraint engine set the value to satisfy a constraint.
Constraints skip any variable whose cfgStatus is User. As a result, a constraint that would otherwise change the variable has no effect on a user-set value. To enforce a value regardless of user input, make sure no user-set value conflicts with the constraint.
In some conditions, the constraint engine can override a value set by a user. If this happens, contact Salesforce Customer Support.
Note
For more information about the supported constraints, see:
The table constraint in Constraint Modeling Language (CML) is used to define a set of valid combinations of values for two or more attributes. These combinations are specified in rows within the constraint definition.
In Constraint Modeling Language (CML), constraint() and require() can both enforce behavior, but they operate differently: constraint focuses on logical consistency, require focuses on physical presence of products.
The CML Action Rule is defined using the rule() keyword. Its primary purpose is to execute a designated action, specified as a string literal, when a condition is met.
The Hide or Disable Rule uses the rule() keyword to conditionally remove an element from the selection menu (hide) or preserve it in the menu while preventing user selection (disable).
The recommend keyword is used within a Constraint Modeling Language (CML) rule to display suggestions for related products in the Product Configurator. The rule defines the condition under which a specific product type or relation should be suggested to the user.
Use the productSellingModel tagname to write a constraint that sets the Product Selling Model (PSM) for a type. You can define a PSM as one time, time-deferred (subscription with end date), or evergreen (recurring subscription with no preset end date). The PSM is updated for new line items at runtime, based on the constraint.