SAP Knowledge Base Article - Public

3404126 - GetAllItems method returning removed products from container

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

  1. Create a Container Attribute and add at least 1 product to it
  2. Create a Global Script with the following snippet:
    • affectedItems = context.Quote.GetAllItems()
             for quoteItem in affectedItems:
                  Log.Write(str(quoteItem.PartNumber))
  3. 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
  4. Create a Quote
  5. Add the Container created with at least 1 product selected on it
  6. Check the logs, see that it is being logged the Main Product and all the added products in the container
  7. Edit the product and remove some of the container products
  8. Update the Quote
  9. 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