Loading

Price Rule Faulty Calculate Scenarios on updates to fields in CPQ

Date de publication: Aug 20, 2024
Description

Issue Description

  • Customer has set up a scenario to update a Checkbox on the Quote which indicates whether or not the Quote will require Approval.

Expected Behavior

  • The Quote checkbox will be updated accurately based on the Customer’s outlined conditions any time the Quote is calculated.

Actual Behavior

  • The checkbox will not update under the initial conditions.

 

Customer Setup

  1. Create a Picklist field on both Product & Quote Line with the API name: Flagged__c with values A, B, C
  2. Create a Quote Line Checkbox Field with the API name:  RequiresApproval__c
  3. Create a Quote Checkbox Field with the API name : ApprovalRequired__c
    1. Add to Quote’s ‘Line Editor’ Field Set
  4. Create a Quote Line Checkbox Formula Field with the API name: Product_requires_approval__c
    1. Formula logic: IF(RequiresApproval__c=TRUE, TRUE, FALSE)
    2. Add Flagged__c, RequiresApproval__c, Product_requires_approval__c to Quote Line’s ‘Line Editor’ Field Set

 

Summary Variable Setup:

  1. Create a Summary Variable named: Sum QL where Approval is required
  2. Target Object - Quote Line
  3. Aggregate Function : Count
  4. Aggregate Field : Quantity
  5. Filter Field : Product_requires_approval__c
  6. Operator: Equals
  7. Filter value : true

 

Price Rule 1 Setup:

  1. Create a Price Rule named ‘Clear QL Approval Requirement’ where:
  2. Calculator Evaluation Event = On Initialization

Price Action:

  1. Target Object : Quote Line
  2. Target Field : RequiresApproval__c
  3. Value : false

 

Price Rule 2 Setup:

  1. Create a Price Rule named ‘Check if QL requires Approval’ where:
  2. Calculator Evaluation Event = Before Calculate

Price Condition:

  1. Object: Quote Line
  2. Field : Flagged__c
  3. Operator : equals
  4. Filter Type : Value
  5. Filter Value : A

Price Action:

  1. Target Object : Quote Line
  2. Target Field : RequiresApproval__c
  3. Value : true

 

Price Rule 3 Setup

  1. Create a Price rule named ‘Lines Require Approval-> flag Quote’ where:
  2. Calculator Evaluation Event = After Calculate

Price Condition:

  1. Tested Variable: Sum QL where Approval is required
  2. Operator : not equals
  3. Filter Type = Value
  4. Filter value = 0

Price Action:

  1. Target Object: Quote
  2. Target Field : ApprovalRequired__c
  3. Value : True

Test Steps:

  1. Make the Product Pick-List value ‘A’ for a Product
  2. Create a Quote
  3. Add Products
  4. Select the Product you modified above
  5. Select

Observe:

  1. Flagged__c = A
  2. RequiresApproval__c = True
  3. Product_requires_approval__c = True
  4. Quote: ApprovalRequired__c = false
Note: Pressing 'Calculate' or 'Save' (subsequent Calculations) will not correct the Quote field.

Expected:

  1. Quote’s ApprovalRequired__c will be true

Why this occurs:

  1. Flagged’ field will map on Product→ QLE transition
  2. 1st Price rule: RequiresApproval__c is nulled On Initialization
  3. 2nd Price rule: RequiresApproval__c will populate on Before Calculate
  4. Quote Line Formula: Product_requires_approval__c field will process after ‘After Calculate’ (Formulas evaluate only before Before Calculate and after After Calculate events).
  5. 3rd Price rule: ApprovalRequired__c remains null, because the Summary Variable is filtering based on a formula where ‘Requires Approval’ is an input field for the formula, so it will have a stale value until after the After Calculate Evaluation Event.
Résolution

Create a new Price Rule to evaluate in a single Calculation:

  1. Create a Quote Line Checkbox Field with API name: QLFsubstitute__c
  2. Create a 4th Price Rule named ‘QL Approval formula Substitute’ where:
  3. Calculator Evaluation Event = On Calculate
    1. Price Action:
      1. Target Object: Quote line
      2. Target Field : QLFsubstitute__c
      3. Formula :IF(RequiresApproval__c=TRUE, TRUE, FALSE)
  4. Navigate to Summary Variable named: Sum QL where Approval is required
  5. Change Filter Field to QLFsubstitute__c


Test Steps:

  1. Make the Product Pick-List value ‘A’ for a Product
  2. Create a Quote
  3. Add Products
  4. Select the Product you modified above
  5. Select

Observe:

  1. Flagged__c = A
  2. RequiresApproval__c = True
  3. Product_requires_approval__c = True
  4. Quote: ApprovalRequired__c = True



 

1st Calculate   Solution Column
On Initialization Summary Variables    
On Initialization Price Condiitons    
On Initialization Price Actions 1st Price Rule:
QL RequiresApproval updates to Null
 1st Price Rule:
QL RequiresApproval updates to Null
Formulas Quote Line field: Product_requires_approval__c evaluates to False Quote Line field: Product_requires_approval__c evaluates to False
Before Calculate Summary Variables    
Before Calculate Price Conditions 2nd Price rule:
Condition is met
 2nd Price rule:
Condition is met
Before Calculate Price Actions 2nd Price rule:
Price Action updates RequiresApproval to True
 2nd Price rule:
Price Action updates RequiresApproval to True
On Calculate Summary Variables    
On Calculate Price Conditions    
On Calculate Price Actions   4th Price Rule:
Price Action updates
QLFsubstitute__c to True
Pricewaterfall + Prorate Multiplier    
After Calculate Summary Variables Summary Variable: 'Sum QL where Approval is required'
returns no records as Product_requires_approval__c is False
 Summary Variable: 'Sum QL where Approval is required'
returns records as QLFsubstitute__c is True
After Calculate Price Conditions 3rd Price Rule: Condition is not met 3rd Price Rule: Condition is met
After Calculate Price Actions 3rd Price Rule does not action 3rd Price Rule:
Price Action updates
ApprovalRequired__c Quote Field to true
Formulas Product_requires_approval__c evaluates as True Product_requires_approval__c evaluates as True
*End-User Value* Quote ApprovalRequired__c Field = False 
 Quote ApprovalRequired__c Field = True


Ressources supplémentaires
SEE ALSO
Numéro d’article de la base de connaissances

000392665

 
Chargement
Salesforce Help | Article