The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Create a CpqAppHandler Hook

You can write custom Pre-invoke and Post-invoke hooks for an interface to implement custom logic. To change the default behavior of a CPQ operation, you create a custom implementation of the CpqAppHandler hook interface, CpqAppHandlerHook. The example used to illustrate the tasks is a customization that prices products in the Industries CPQ Cart based on a customer’s billing zip code.

​Salesforce Industries Communications, Media, and Energy and Energy & Utilities Cloud use the CpqAppHandler hook interface.

To create a custom implementation of CpqAppHandlerHook involves multiple tasks. These tasks include setting up a matrix, editing the pricing plan, creating an Apex class, and modifying the Cart.

Pricing Products Based on Zip Code

Management has come to Felix with the requirement that they’d like the ability to price products in the Industries CPQ Cart based on a customer’s billing zip code. Felix knows he can price products based on their attributes using attribute-based pricing, but using the customer’s billing zip code has him stumped. Felix scratches his head wondering how this can be accomplished. In Felix’s research, he comes across the topic in software development called a hook. This is the answer to Felix’s dilemma. Using a hook, he can modify the pricing behavior in the cart without changing the underlying programming code. Felix saddles up to the challenge and starts by mapping out the steps required to fulfill management’s request.

  1. Review the uses of CpqAppHandlerHook.

  2. Review the billing zip code custom field.

  3. Create an attribute pricing matrix for billing zip code.

  4. Create an attribute pricing procedure for billing zip code.

  5. Create a custom pricing plan step for billing zip code.

  6. Create a new Apex class.

  7. Create the CpqAppHandlerHookImplementation.

  8. Add a new column to the cart.

  9. Add billing zip code as a custom field in the cart.

  10. Test in the cart.

  11. Troubleshoot if necessary.

See Also