Loading

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

Дата публикации: Jun 9, 2026
Описание

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

Important:

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

Additionally, The CML structure used to achieve classification-level logic differs depending on the product context:

  1. Standalone products and bundle parent products → Use the standard classification type approach (see Resolution — Scenario A)
  2. Child products within a bundle → A different CML structure is required that imports the bundle and uses property allowMissingRelation = true (see Resolution — Scenario B)

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 - When the product is a standalone product or a bundle parent:

@(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.

Sample Code - When the product is a child product:

For the CML logic to work on a child product within a bundle, the bundle must be imported into the Constraint Model. The child product then inherits the classification logic from the type hierarchy. Avoid importing all attributes unnecessarily when doing this, as it can increase the CML size.

property allowMissingRelation = true;

type LineItem;

@(virtual=true)
type Quote{
    @(sourceContextNode = "SalesTransaction.SalesTransactionItem")
    relation clsCmp: classification;
}

type classification : LineItem  {
    @(defaultValue = "i5-CPU 4.4GHz")
    string Windows_Processor = ["i5-CPU 4.4GHz", "i7-CPU 4.7GHz", "Intel Core i9 5.2 GHz"];
    constraint(Windows_Processor == "Intel Core i9 5.2 GHz");

type LaptopBasicBundle : classification {
    relation bundlep : BundleP {
        default BundleP(1);
    }

    relation laptopbag : LaptopBag;

    relation laptop : Laptop[1..999] {
        default Laptop(1);
    }

    relation antivirus : Antivirus[1..999] {
        default Antivirus(1);
    }
}

type BundleP : classification;

type LaptopBag : classification {
    @(defaultValue = "true")
    boolean Advance_Ecommerce;
    string Size;
}

type Laptop : classification;

type Antivirus : classification;

In this example:

  1. The bundle (LaptopBasicBundle) must be imported into the Constraint Model and the bundle type must extend classification.
  2. Child product types (e.g., Laptop, Antivirus, LaptopBag) also extend classification directly, inheriting its attributes and constraints.


Решение

Common steps in both the scenarios:

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.

Scenario A: When the product is a standalone product or a bundle parent

Step 1: Add a type (name: Classification) in CML and map it 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 2: Define the constraint rule under the Quote type according to the business use case. See the Sample code given in "Description" section for scenario A.

Step 3: 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.
  4. Open a Quote and configure the product with required classification.

Note: This rule will only get applied to the standalone and bundle parent products associated with the Product Classification.

Behaviour: As per the example code given in description (Scenario A):

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

Scenario B: When the product is a child product

Step 1: Set the property "allowMissingRelation" to true

Step 2: Define LineItem and the Classification Type:

  • Define the LineItem type first, and then define the Classification type by extending LineItem. After that, create the association with the Product Classification, define the required type variables for it, and import the necessary attribute variables.

Step 3: Import the Bundle and Define Child Types

  • Import the bundle product using the Visual Builder, then switch to the CML Editor and update the parent bundle to extend classification. Define all child product types similarly. Remove the unnecessary attributes defined under the products.

Step 4: Define the constraint rule under the Quote type according to the business use case. See the Sample code given in "Description" section for scenario B.

Step 5: 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.
  4. Open a Quote and configure the product with required classification.

Behaviour: As per the example code given in description (Scenario B):

  1. Windows_Processor defaults to "Intel Core i9 5.2 GHz" on load for the child product of the bundle.
  2. The constraint Windows_Processor == 'i5-CPU 4.4GHz' is enforced across all matching Classification items in the transaction.
Номер статьи базы знаний

005385561

 
Загрузка
Salesforce Help | Article