Salesforce CPQ: Advanced Approvals Variables

  • Blog
  • Salesforce CPQ: Advanced Approvals Variables
blog image
27
Jan

Approval Variables are an Advanced Approvals object. Simply put, they are a number that represents the result of evaluating multiple records and can be compared to roll-up summary fields (bonus: they don't count against the roll-up summary limits). Approval Variables allow you to count records, calculate the sum, average, minimum value, or maximum value of a field on the target object. They are then used for evaluation in approval conditions on Approval Rules.

Setting up an Approval Variable means basically identifying:

 what records need to be evaluated, and 

 how we should evaluate them. 

 

Let's set up an Approval Variable that sums the Net Total of quote lines where the Product Type is "License". You will need to update Target Object, Aggregate Field, and Filter Field picklists to add the necessary API names (from Setup > Object Manager > Approval Variable > Fields and Relationships).

 First, enter a brief but descriptive name for the Variable Name.

 Next, identify the object you need to evaluate. This would be the Target Object field which points to a child object of the object submitted for approval. For this example, it would be SBQQ__QuoteLine__c, the API name of the Quote Line object.

 Then, identify which field you need to evaluate. This is the Aggregate Field. This would be the SBQQ__NetTotal__c. Note that the Aggregate Field must live on the Target Object (the quote line, in this case). 

 Next, we need to specify what to do with the found Net Totals in the Aggregate Function field. In this case, we want to sum the Net Total values.

 Then, we need to filter the records to consider only the ones where the Product Type is "License ."Hence, in the Filter Field, we select the API name for the Product Type field, Operator = equals and Filter Value = License.

 For the Type field, select Summary because we are evaluating a field different from List Price or Net Price, in which case the Type would be Discount (and we would then have to populate the List Variable and the Net Variable fields ).

 Save the Approval Variable.

CPQ Approval Variable with type summary

Now go to an Approval Rule, create a new Approval Condition and populate the Tested Variable field with the newly created Approval Variable. Then, you will need to enter the Filtered Information. That is, populate the Operator (e.g. greater than), Filter Type (Value), and Filter Value (e.g. 1500). This would trigger an approval rule when the "Net Total of quote lines where the Product Type is "License" is greater than 1500".

CPQ Approval Condition with Approval Variable

Remember that approval variables can only evaluate records that have a lookup relationship to the object we are trying to approve, i.e., the Target Object on the Approval Rule. In this case, we can evaluate quote lines because they have a lookup relationship to the quote. However, we won't be able to evaluate Opportunity Products, for example, because they are not related to the quote directly. This won't trigger an error message but the approval conditions that use this approval variable will never be met. 

Another nice feature is that we can combine approval variables with other approval variables. Suppose we have an approval variable that identifies the maximum discount on Services and another approval variable that identifies the maximum discount on Licenses. We could update a variable by populating the Combine With field and thus get an "advanced" approval variable whose output would be the result of this combination.

CPQ Approval Variable Combine with field

When creating Approval Variables, note that not all fields are visible or editable depending on the page layout and field-level security settings.

Find more blog posts on Advanced Approvals for Salesforce CPQ in our Approvals Category.

Comments (1)

Harini
Feb 9, 2022

All the blogs are really good.. Thankyou for posting.

Leave a Comment