top of page
Search

CML 101: Building Your First Model in Salesforce Revenue Cloud

  • Writer: ANJNEYA Parashar
    ANJNEYA Parashar
  • Jan 27
  • 2 min read

CML stands for Constraint Modeling Language. It is a domain-specific language used in Salesforce Revenue Cloud to describe complex systems—like product bundles—without needing extensive code.


  • Core Purpose: It defines the "building blocks" of a product and enforces business logic declaratively.


  • How it works: A constraint engine compiles your CML code into a model to ensure that every product configuration follows your specified rules

The Building Blocks: Types and Variables


The foundation of any CML model consists of Types and Variables.

  • Types: These represent the entities or objects in your model, such as a standalone product, a bundle, or a product class.


  • Variables: These define the properties or characteristics of a type, such as its size, color, or quantity.


In Revenue Cloud, variables often represent product fields or attributes. For example, if we are modeling a house, we define the House as a type and its address as a variable.


Code snippet

type House {
    string address;
    int numberOfRooms = [1..10]; // This is a 'Domain' restriction
}

⚖️ Enforcing Logic with Constraints

Once you have your building blocks, you use Constraints to define the rules. A common tool is the Implication Operator (->). This operator says: "If a certain condition is met, then this result must also be true".


For instance, we might want to say that if a house has more than 5 rooms, it must be a "Spacious" category.


🚀 Performance Matters: Best Practices

To keep your configuration engine running fast, keep these two tips in mind:

  1. Small Domains: Keep the list of allowed values for a variable as small as possible to reduce the number of combinations the engine has to test.


  2. Explicit Cardinality: When defining relationships between products, always specify the smallest required range

 
 
 

Comments


bottom of page