Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Recommendation Rule

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.

You can recommend a type, a relation, or both in the same rule. The recommendation rule can be added inside a standalone product, a product bundle, or a virtual container.

Unlike action rules that are interpreted directly by the Product Configurator API, when the condition is met, the engine forces a UI change (hiding or disabling a product option, attribute, or value). Recommendations are not automatically applied to the UI by the configuration engine alone. To suggest types or relations (products/bundles), typically for up-selling or cross-selling based on their current selections at runtime, use the Run Config Rules action within a Salesforce Flow. See Run Config Rules Action in the Revenue Cloud Developer Guide.

  • Use an action rule when a selection makes another option invalid or irrelevant. For example, if a user selects a basic warranty, you should "hide" or "disable" the premium support options to prevent a conflicting or impossible setup.
  • Use a recommendation rule when you want to nudge the user toward a beneficial add-on. For example, if a user buys a high-end generator, you "recommend" a maintenance service contract. This does not block the user if they choose not to add it.

Here are 3 examples demonstrating how to implement product recommendation rules.

Example 1: Recommending a Type (Based on Attribute Selection)

This rule is placed within the GeneratorSet type. If a user selects an extremely high voltage, the configuration engine recommends a specialized engineer component required for installation or commissioning.

1type GeneratorSet {
2// Attribute input
3string Voltage = ["277/480", "7976/13800"];
4// Relation to the component type being recommended
5relation engineers : engineer[0..99];
6// Recommend Engineer Specialist (type) for High Voltage
7rule(
8Voltage == "7976/13800", "recommend", "type", "EngineerSpecialist"
9);
10}
11// Recommended type
12type EngineerSpecialist ;
13type engineer;

Example 2: Recommending a Relation (Based on Component Quantity)

This rule recommends adding items to an existing relation (Accessories) if the user selects a high-end component (such as the most robust enclosure, Enclosure_SA3).

1type GeneratorSet  {
2// Relations defined in the GeneratorSet
3relation Enclosures : Enclosure;
4relation Accessories : Accessory[1..99]; // The relation being recommended
5// Recommend Accessories when maximum sound dB is chosen
6rule(
7Enclosures[Enclosure_SA3] == 1,
8"recommend",
9"relation",
10"Accessories");
11}
12type Enclosure ;
13type Enclosure_SA3 : Enclosure;
14type Accessory ;

Example 3: Recommending a Type (From a Virtual/System Container)

This rule is applied at the Quote or System level (using a virtual type) and recommends a system integration product if multiple generators are being configured, reflecting the requirement that large projects often need central control components.

1@(virtual = true)
2type Quote {
3// Relation referencing all GeneratorSet instances on the quote
4@(sourceContextNode = "SalesTransaction.SalesTransactionItem")
5relation lineItems : GeneratorSet[0..10];
6// Recommend Switchgear for multi-unit orders
7rule(
8lineItems[GeneratorSet] > 1,
9"recommend",
10"type",
11"Switchgear"
12);
13}
14type GeneratorSet;
15type Switchgear;