Loading

Salesforce CPQ (Managed Package): 'Attempt to de-reference null object' error on Amend of dataloaded MDQ Subscriptions

Fecha de publicación: Oct 26, 2026
Descripción

In certain circumstances, pressing 'Amend' on a Contract to load the Salesforce CPQ Amend Visualforce page will return 'Attempt to de-reference null object' error if MDQ subscription data has been dataloaded in such a way that subsequent revised segments are created before their earlier segments.

Package logic:
During amendment when Subscription data is loaded it first has an order by clause added to it for CreatedDate ASC, and then an additional clause for Name ASC is added.

Later on when setting the segment quantities CPQ processes the subscriptions in order from the query results. It stores a reference to them in a map because later on the logic checks if a Subscription has a value for RevisedSubscription, is so the package looks up that Subscription from the map and get the quantity. If that sub hasn't been processed yet it will cause an NPE.

Hitting an Attempt to de-reference null object error only happens when:

    • A Subscription has RevisedSubscription__c populated (pointing to its original)
    • That revised Subscription has SegmentQuantity__c != null (true for all MDQ segments)
    • The revised Subscription is iterated BEFORE its original in the list
Solución

To handle the aggregation appropriately, the revised mdq Subscriptions should be loaded in stages / separate batches.

For example: first load the original Subscription data. Then 1st amendment revision Subscription data. Then 2nd amendment revision data. 

Número del artículo de conocimiento

005465390

 
Cargando
Salesforce Help | Article