Loading

Revenue Cloud Advanced: How to Use CML Logic at the Product Classification Level Without Adding Products Individually

Publish Date: May 27, 2026
Description

When multiple products share the same attributes and require identical constraint logic (for example, making an attribute picklist value default), a common challenge is that standard CML import requires each product to be added to the Constraint Model individually. This becomes unmanageable when dealing with a large product catalog.

In Revenue Cloud Advanced (RCA), CML supports type hierarchies — an inheritance model where a parent type (mapped to a Product Classification) can hold all shared logic, and child products inherit it automatically.

When this is applied:

  • Multiple products share the same attributes
  • The same require/constraint logic should apply to all those products
  • You want to avoid duplicating rules or importing dozens of products individually into the Constraint Model

Note: Product Classification import in CML is currently only available via the CML Editor. It is not supported in the Visual Builder at this time.

Prerequisites:

  1. Create a Product Classification in the Product Catalog.
  2. Define the attributes in the Product Classification.
  3. Assign the Product Classification to those products where you want to apply the constraint logic.

Sample Code:

@(virtual = true)
type Quote {
    @(sourceContextNode = "SalesTransaction.SalesTransactionItem")
    relation beyondProducts : Classification[0..999];

    constraint(beyondProducts[Classification].TestAttribute == 'B');
}

type Classification {
    string TestAttribute = ["A", "B"];
}

In this example:

Classification is the type mapped to a Product Classification record in Salesforce.
All products assigned to that Product Classification already inherit the TestAttribute.

Resolution

Step 1: Open Your Constraint Model in the CML Editor

  1. Go to Product Catalog Management app and click on Constraint Models.
  2. Open the Constraint Model you want to edit (or create a new one).
  3. Click Deactivate if the model is currently active — edits are only allowed on inactive models.
  4. Click the CML Editor tab.

Note: Product Classification import is not supported in the Visual Builder. You must use the CML Editor for this approach.

Step 2: Define the Virtual Quote Container
At the top of the CML Editor, add the Quote virtual type (type Quote). This is the transaction-level container that holds all product type relations. Every CML model using classifications needs exactly one virtual container.

Step 3: Copy the attributes from the product.

  1. Import the Product using the Visual Builder and switch to CML Editor.
  2. Copy the attributes from under the Product level.
  3. Delete the product from the CML Editor.

Step 4: Define the Classification Type with Its Attributes
Immediately below the Quote type in the CML Editor, add the Classification type. This type maps to your Product Classification record and define the copied attribute from the products.

Step 5: Map the Classification Type to the Product Classification Record

  1. In the CML Editor, click on the Classification type defined and move to the Associations tab.
  2. Map it to the Product Classification record in Salesforce (not an individual product).

This ensures the constraint engine applies the logic to all products under that classification automatically.

Step 6: Save, Activate, and Test

  1. Click Save in the CML Editor.
  2. Review any validation errors surfaced by the editor and resolve them before proceeding.
  3. Click Activate to activate the Constraint Model.

Observation:

Open a Quote and configure the product with required classification.

Behaviour as per the example code given in description:

  1. TestAttribute defaults to "A" on load.
  2. The constraint TestAttribute == 'B' is enforced across all matching Classification items in the transaction.

Current Limitations:

Classification-level CML logic currently applies to standalone products only. The following scenarios were tested and confirmed to not work with the classification-level CML approach:

 

  1. Scenario 1: Child product added via classification under a bundle product
  2. Scenario 2: Static child product having CML classification under a bundle product
  3. Scenario 3: Bundle parent having CML classification
Knowledge Article Number

005385561

 
Loading
Salesforce Help | Article