Communications / Industries CPQ
GET Basket returns INVOKE-500 after deleting an auto-added optional child of a virtual product and then applying a promotion
Summary
After an auto-added optional child of a virtual product is deleted from the basket and a promotion is then applied, the GET Basket API returns INVOKE-500, and every later getBasket call on that cart also fails.
Cause: Applying the promotion re-creates the deleted optional child with a new lineItemKey. Under a virtual parent, the re-created line is never priced and has no pricing log data. Building the getBasket response then fails with a NullPointerException. Under a non-virtual parent the child is also re-added, but it is priced, so no error is returned and the deletion is silently undone.
Conditions: The optional child (Min 0 / Max 1 / Default 1) sits under a virtual group, and the promotion doesn't target it. The failure occurs only when the child is deleted first and the promotion is applied afterwards.
Workaround
Salesforce hasn't published a workaround. Check the official page.
Steps to reproduce
1. Configure the Product Structure
Create an offer with the following hierarchy:
- Root Offer
- Child Product
- Grandchild Product (targeted by the promotion)
- Virtual Group (IsVirtualItem = true)
- Optional Child Product (Min: 0, Max: 1, Default: 1)
- Child Product
The optional child product is automatically added to the basket.
2. Configure the Promotion
Create a promotion that:
- Applies a discount (e.g., 20%) to the Root Offer.
- Targets the Grandchild Product.
- Does not target the Optional Child Product.
3. Reproduction Steps
- Add the Root Offer to a new basket using AddWithNoConfig. The optional child product is automatically added.
- Delete the optional child product using deleteFromBasket, passing the Root Offer's lineItemKey as the bundleContextKey and the optional child's lineItemKey.
- Retrieve the basket using GET Basket API. The API returns HTTP 200, and the deleted child is no longer present.
- Apply the promotion using AddWithNoConfig. The API returns HTTP 200.
- Retrieve the basket again using GET Basket API.
Actual Result:
The GET Basket API returns an INVOKE-500 error because the promotion re-adds the previously deleted optional child under the virtual parent with a new lineItemKey. Since the re-created child is not priced, the API encounters a NullPointerException.
Additional Scenario: Non-Virtual Parent
The same behaviour occurs when the optional child is directly under a non-virtual parent (Root Offer).
When the promotion is applied, the deleted child is re-added with a new lineItemKey. However, since the item is successfully priced, the GET Basket API returns HTTP 200 without an error.
In this case, the user's deletion is silently overridden, as the previously deleted child product is restored to the basket.
History
First tracked here as Solution in Progress with 1 report
Nov 30, 2026