Loading

Entity Filter Skips QuoteLineItem Custom Fields in PostCartsItems (Standard Cart APIs)

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

Issue

When a Modify Attribute Rule is configured to hide a product attribute based on an Entity Filter condition that references a custom field on the QuoteLineItem object, the rule always executes in Standard Cart APIs — even when the Entity Filter condition evaluates to false. The attribute is incorrectly hidden regardless of the custom field value.

This behavior occurs only with Standard Cart APIs (postCartsItems). The same Entity Filter evaluation works correctly in Classic Cart APIs.

Symptoms

  • A product attribute inside a bundle is always hidden by a Modify Attribute Rule, regardless of the QuoteLineItem custom field value.
  • The Entity Filter condition appears to be ignored — the rule fires unconditionally.
  • The issue is limited to Standard Cart APIs; Classic Cart APIs evaluate the same Entity Filter correctly.

Root Cause

In Standard Cart APIs, QuoteLineItem custom field values may not be loaded at the time Entity Filters are evaluated during postCartsItems processing. Because the referenced custom field has no value available, the Entity Filter condition cannot evaluate to true, and the Modify Attribute Rule defaults to executing (hiding the attribute).

Steps to Reproduce

  1. Create an Entity Filter condition that references a custom field value on the QuoteLineItem object.
  2. Create a Modify Attribute Product Relationship to hide an attribute of a child product inside a bundle.
  3. Create a Vlocity Rule that associates the Entity Filter with the Product Relationship.
  4. Add the bundle product to the cart using Standard Cart APIs.
  5. Observe that the attribute of the child product is not visible, even though the Entity Filter condition evaluates to false.
Решение

Use a CpqValidationHook preInvoke implementation to populate the required QuoteLineItem custom field values before Entity Filter evaluation occurs.

Step 1: Create the Hook Implementation Class

Create an Apex class that implements vlocity_cmt.VlocityOpenInterface:

global class CpqValidationHookImpl implements vlocity_cmt.VlocityOpenInterface {
    global Boolean invokeMethod(String methodName, Map<String, Object> input,
            Map<String, Object> output, Map<String, Object> options) {
        if (methodName.equalsIgnoreCase('executeValidationRules.PreInvoke')) {
            executeValidationRules_PreInvoke(input, output, options);
            return true;
        }
        if (methodName.equalsIgnoreCase('executeValidationRules.PostInvoke')) {
            executeValidationRules_PostInvoke(input, output, options);
            return true;
        }
        return false;
    }
    private void executeValidationRules_PreInvoke(Map<String, Object> input,
            Map<String, Object> output,
            Map<String, Object> options) {
        vlocity_cmt.CpqCartDocument cartDoc =
            (vlocity_cmt.CpqCartDocument) input.get('cartDocument');
        Map<String, Object> outputLineItems = cartDoc.call('getAllItems',
            new Map<String, Object>{'hierarchyLevel' => -1});
        // Populate your QuoteLineItem custom field values on each item here
    }
    private void executeValidationRules_PostInvoke(Map<String, Object> input,
            Map<String, Object> output,
            Map<String, Object> options) {
        // Post-validation logic if needed
    }
}

Step 2: Register the Hook Interface

Register the hook implementation through Interface Implementation:

  1. Navigate to Vlocity CMT Administration → Interface Implementation.
  2. Create a new Interface Implementation Detail record with these values:
    • Interface Name: CpqValidationHook
    • Implementation: CpqValidationHookImpl (or your class name)
    • Is Active: true
    • Is Default: true

Step 3: Activate the Hook

  1. Run Clear Managed Platform Cache from Maintenance Jobs.
  2. Run Generate Compile Data from EPC Jobs.
  3. Verify that compile data generates successfully — the hook is now active.

Step 4: Verify the Fix

  1. Add the bundle product to the cart (using Standard Cart APIs).
  2. Confirm the child product attribute is now visible when the Entity Filter condition evaluates to false.
  3. Confirm the attribute is hidden when the Entity Filter condition evaluates to true.
Номер статьи базы знаний

005388964

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