+ Start a Discussion
Leonard CadetLeonard Cadet 

Creating Code Through Custom Scripts to allow Pricing Rules to evaluate on the Quote Line of CPQ quotes

Currently Price Rules we have set up aren't working. It looks like we need to set up a Quote Calculator Plugin using custom code to have price rules checked passed on the critera of a quote line. So far I did reasearch and found this:
https://developer.salesforce.com/docs/atlas.en-us.cpq_dev_plugins.meta/cpq_dev_plugins/cpq_dev_jsqcp_methods.htm 

It discribes the different methods needed to create your QuoteCalculator Plug In. Below is how I put the code in the custom scripts:
 
export function onInit(quoteLineModels) {
return Promise.resolve();
};

export function onBeforeCalculate(quoteModel, quoteLineModels ) {
return Promise.resolve();
};

export function onBeforePriceRules(quoteModel, quoteLineModels ) {
return Promise.resolve();
};

export function onAfterPriceRules(quoteModel, quoteLineModels ) {
return Promise.resolve();
};

export function onAfterCalculate(quoteModel, quoteLineModels) {
return Promise.resolve();
};
Also attached is me putting lines that should be refeenced (I'm basically guessing at this point)
User-added image
But when I go to edit lines I get the following error:
Cannot read property 'replace' of null

How do I set up the plug in so price rules that are created are checked and updated accordingly?