Salesforce CPQ: Summary Variable Use Case

  • Blog
  • Salesforce CPQ: Summary Variable Use Case
blog image
16
Aug

So you need to automatically add a product to a new quote if the customer hasn't got any active subscriptions belonging to a specific Product Family (e.g., Software). You can achieve this with the help of a summary variable and a product rule.

Summary variables can target the quote line, product option, subscription, or asset. They can calculate the SUM, AVERAGE, MIN, and MAX values of a number field. They can also COUNT the number of records that meet the filter criteria. You can set up the summary variable to consider records that match the filter criteria. Then, you can reference them in price conditions, price actions, product rule error conditions, product actions, quote term conditions, and other summary variables. 

First, to filter through Product Families on the Subscriptions records, we need to create a formula field (Product_Family__c) to pull this value from the related quote line or from the related Product record.

Then, we need to set up a Summary Variable (Active Software Subscriptions) where:

 Target Object = Subscription 

 Aggregate Function = SUM

 Aggregate Field = Quantity (Note: The Aggregate Field must be a number field, e.g., Quantity or List Price)

 Filter Field = Product_Family__c (First, add the API name of the custom Product Family field created in the previous step to the Filter Field picklist values in Setup > Object Manager > Fields and Relationships > Filter Field)

 Operator = Equals

 Filter Value = Software

You don't need to worry about filtering active Subscriptions because Salesforce CPQ only considers active contracts. The Summary Variable will return a value of 0 if the related contracts are all inactive.

Next, you need to create a Selection Product Rule where:

 Type = Selection 

 Scope = Quote

 Evaluation Event = Always

 Conditions Met = All

Then, create the Error Condition that causes the rule to evaluate only when there are no Active Software Subscriptions related to the Account:

 Tested Variable = Active Software Subscriptions

 Operator = equals

 Filter Type = Value

 Filter Value = 0

Note that all aggregate functions, except Max and Min, return "0" when a summary variable's aggregate field or search filters don't return any records. Max and Min functions would return a null value. 

Next, create a Product Action that will add the necessary Product whenever the rule executes. 

 Type = Add

Selection Rules with the scope of Quote you can only Add. Other actions such as remove, enable, disable, show, or hide can't be leveraged. 

 Product = Select the Product that should be added to the Quote

 Required = checked

Remember that you must set the 'Required' checkbox to 'True' for any 'Add' action to function.

Now you can verify rule behaves as expected. In order to test, you need two accounts: one that has active software subscriptions and another that does not. Create a quote, then add a product to it - this is necessary for the Quote Scoped Product Selection Rules to execute. Alternatively, it executes when you reconfigure to save a bundle that already exists on the Quote. 

Comments (1)

Lakshmi
Aug 19, 2022

Thanks a lot

Leave a Comment