Pricing Extension Callback Class
You can use the Pricing Extension Callback Class to define any logic or computation you need to execute before or after the pricing is calculated for the line items. You must define the pre-pricing or post-pricing hooks in the Pricing Extension Callback. The pre-pricing and post-pricing logic are executed separately from the pricing that is calculated when the Sales rep clicks Submit for Pricing(Async) button. This allows CPQ to run the pricing without executing custom logic every time.
The pre-pricing and post-pricing logic are executed when the Sales rep clicks Pre-Price and Post-Price buttons respectively, on the Cart page. If you define Auto Execute Post-Pricing Step and Auto Execute Pre-Pricing Step settings, the pre-pricing and post-pricing logics are executed automatically when the Sales rep clicks Submit for Pricing(Async). For more information, see Config System Properties.
The following methods are available to you in Pricing Extension Callback Class.
Method | Signature | Description |
---|---|---|
afterPricing() | Apttus_Config2.CustomClass.PricingExtensionResult afterPricing(Apttus_Config2.ProductConfiguration, Apttus_Config2.CustomClass.CartHelper) | You can use this method to execute logic that is required post-processing after line items are priced |
beforePricing() | Apttus_Config2.CustomClass.PricingExtensionResult beforePricing(Apttus_Config2.ProductConfiguration, Apttus_Config2.CustomClass.CartHelper) | You can use this method to execute logic that is required pre-processing to prepare the cart line items for pricing. |
isAfterPricingEnabled() | Boolean isAfterPricingEnabled() | You can use this method to determine whether after-pricing should be invoked for the callback. |
isBeforePricingEnabled() | Boolean isBeforePricingEnabled() | You can use this method to determine whether before-pricing should be invoked for the callback. |
Pre-Pricing Logic
You can define logic in beforePricing() method of Pricing Extension callback to execute any computation that drives the pricing of the line item. For example, you can calculate the Total Quantity of reagents across all the locations and use that quantity to determine the tiered price for a line item. You must specify the fields you apply pre-price to in Custom Pre-Pricing Fields. For more information, see Config System Properties.
Post-Pricing Logic
You can define logic in afterPricing() method of Pricing Extension Callback to execute any computations that are dependent on the pricing fields like Net Price and Net Extended Price which are calculated after pricing. For example, if you want to calculate the annual value for a given line item with 3 years of Selling Term and after applying adjustments the Net Price is 3000, then the annual value is 3000/3 = 1000.
Example Code