[SalesForce] CPQ Javascript Quote Calculator Plugin Custom Script not updating

I set up a simple CPQ Javascript Quote Calculator Plugin Custom Script last week and it was working fine. Today, I wanted to update the script, but my changes don't seem to take effect.

My (simplified) custom script is as follows:

export function onAfterCalculate(quote, lines, conn) {
console.log('onAfterCalculate 4');
return Promise.resolve();
}

The name of the Custom Script is: SAPPricing.

In the CPQ Settings Editor -> Plugins -> Quote Calculator Plugin, I have specified the name of the Custom Script: SAPPricing.

However, when I run it, the Console Log outputs 'onAfterCalculate' which was specified in my previous version of this Custom Script.

I have tried running it in different browsers and I keep getting the output from the previous version of the script. It seems like the old script is cached on the server and won't update.

Thoughts?

Mike

Update: I was able to modify it this morning, but after a couple of simple modifications, my updates to the Custom Script no longer are showing up when I perform calculate again.

Best Answer

I've seen this happen when there is an issue in the Javascript. CPQ transpiles the code you paste into the script. I've found that first pasting my plugin code into https://babeljs.io/repl and checking for errors, helps ensure there are no issues.

There is a field on the Custom Script object called Transpiled Code. You can also check that it gets updated after saving your changes.

Edit: There is a Visualforce page you can add to your Custom Script page layout called Custom Script Save. It will tell you the Transpiling status.

page layout with VF page

transpiling status

Related Topic