Symptom
When running GetAllItems method in a script, previously deleted items from a container attribute are being returned, as they were still in the product.
Environment
SAP Sales Cloud CPQ
Reproducing the Issue
- Create a Container Attribute and add at least 1 product to it
- Create a Global Script with the following snippet:
- affectedItems = context.Quote.GetAllItems()
for quoteItem in affectedItems:
Log.Write(str(quoteItem.PartNumber))
- affectedItems = context.Quote.GetAllItems()
- Add Script to following event:
- On Adding Products to the Quote:
- after deleting products from quote
- before adding products to quote
- before updating products in quote
- On Adding Products to the Quote:
- Create a Quote
- Add the Container created with at least 1 product selected on it
- Check the logs, see that it is being logged the Main Product and all the added products in the container
- Edit the product and remove some of the container products
- Update the Quote
- See in logs that deleted products are still being logged.
Cause
Expected Behavior.
Resolution
- GetAllItems() method returns earlier state and new state of the product
- Every item has IsNew and IsDeleted indicators, and based on them it is possible to control what is returned on the script execution result.
See Also
Keywords
Script, GetAllItems, Deleted, Container, Product, CPQ , KBA , CEC-SAL-CPQ , Sales Cloud CPQ , Bug Filed
Product
SAP CPQ 2023