Symptom
When attempting to verify if there is any product in the quote, if using x=Product, a fatal is thrown.
Environment
SAP SALES CLOUD CPQ
Reproducing the Issue
- Create a Quote
- On script workbench, run the following snippet:
try:
x=Product
if x:
Trace.Write("Something")
except Exception as ex:
Trace.Write("Something Else")
Trace.Debug(ex) - Fatal will be thrown prior to except block and code will stop working
- If you first load the product to the quote and then remove it, snippet will work in both cases.
Cause
Expected Behavior
Resolution
- When using x=Product snippet, it will first call Product_GetAttribute() method
- Fatal will occur whenever attempting to assign a product to a variable if there's no product loaded in memory, since there are no loaded attributes
- Why after deleting the configurable product snippet keeps working?
- First time after Product is created, CPQ reuses it in the following requests. It is some sort of optimization, since CPQ recycles one object whole time, but all the Product properties are cleared after the product is added to the quote, meaning that, when configurator is opened for the first time, Product instance is created and issue with code snippet experienced is not present anymore, even if added item is deleted.
See Also
Keywords
Product, Fatal, Scripting, CPQ , KBA , CEC-SAL-CPQ , Sales Cloud CPQ , Bug Filed
Product
SAP CPQ 2023