Loading

CPQ: NullPointerException in SBQQ.OrderTrigger or SBQQ.OrderProductTrigger when activating or contracting an order

Publish Date: May 26, 2026
Description

This article explains why Salesforce CPQ throws a NullPointerException inside SBQQ.OrderTrigger or SBQQ.OrderProductTrigger when you activate or contract an Order, and how to resolve it. Customers describe this as: "When Order.Status --> Activated, apex error occurs", "Not able to Contract the Order, Getting error SBQQ.OrderTrigger: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object", and "When updating an order so it can run the flow to be activated and contracted, we receive this error". The exact error strings include "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SBQQ.OrderProductTrigger: execution of BeforeUpdate caused by: System.NullPointerException: Argument cannot be null. Class.SBQQ.OrderItemObjectManager.validateOrderedQuantity: line 728" and "SBQQ.OrderTrigger: execution of BeforeUpdate caused by: System.NullPointerException: Attempt to de-reference a null object Class.SBQQ.OrderObjectManager.validateStatusChanges: line 382". The root cause is data inconsistency on the Order Product [OrderItem] or its related Quote Line [SBQQ__QuoteLine__c] — the CPQ package trigger dereferences a field that is null or mismatched. Trigger conditions include: setting Status [Status] to Activated on an Order [Order]; selecting the Contracted [SBQQ__Contracted__c] checkbox on an Order; an Apex batch or Record-Triggered Flow that performs either action. Affects Salesforce CPQ Summer '24 and later in Professional, Enterprise, Unlimited, and Developer Editions, in both Lightning Experience and Salesforce Classic.

Resolution

Run the following SOQL in Developer Console or Workbench to inspect the Order Products [OrderItem] tied to the failing Order, replacing [Order Id] with the affected Order's Id:

SELECT Id, OrderItemNumber, Product2Id, Product2.Name, SBQQ__QuoteLine__c, SBQQ__QuoteLine__r.SBQQ__Product__c, SBQQ__QuoteLine__r.SBQQ__Product__r.Name, SBQQ__QuoteLine__r.SBQQ__SpecialPrice__c, SBQQ__QuoteLine__r.SBQQ__ListPrice__c, SBQQ__SegmentKey__c, SBQQ__QuoteLine__r.SBQQ__SegmentKey__c, SBQQ__Activated__c, SBQQ__Contracted__c FROM OrderItem WHERE OrderId = '[Order Id]'

Review the results, then apply the relevant cause below.

Cause 1: Product mismatch between Order Product and Quote Line
1. In the SOQL output, compare Product2Id on each Order Product to SBQQ__QuoteLine__r.SBQQ__Product__c on the same row. If the two values differ, CPQ cannot resolve the Quote Line product when contracting and throws the NullPointerException at Class.SBQQ.QuoteLineVO.setProduct: line 1360 or Class.SBQQ.ContractVO.addSubscription: line 184.
2. Update the Order Product [OrderItem] Product [Product2Id] to match the Product on the related Quote Line [SBQQ__QuoteLine__r.SBQQ__Product__c]. Alternatively, delete the Order and re-order the Quote so Salesforce CPQ regenerates Order Products with matching Products.
3. Save the record.

Cause 2: Missing MDQ Segment data on Order Product or Quote Line
1. In the SOQL output, check SBQQ__SegmentKey__c on every Order Product and on its related Quote Line. For Multi-Dimensional Quoting (MDQ) products both values must be populated and identical.
2. Navigate to Setup > Object Manager > Order Product > Page Layouts and add Segment Key [SBQQ__SegmentKey__c], Segment Index [SBQQ__SegmentIndex__c], and Segment Type [SBQQ__DimensionType__c] to the layout if they are not visible.
3. Update each affected Order Product [OrderItem] so that Segment Key [SBQQ__SegmentKey__c] matches the value on the related Quote Line [SBQQ__QuoteLine__r.SBQQ__SegmentKey__c].

Cause 3: Null Special Price on Quote Line
1. In the SOQL output, identify any rows where SBQQ__QuoteLine__r.SBQQ__SpecialPrice__c is null. Per standard Salesforce CPQ behaviour this field must be either zero or a non-zero value but never null when contracting.
2. Open each affected Quote Line [SBQQ__QuoteLine__c] and set Special Price [SBQQ__SpecialPrice__c] to 0 or to the correct value.

Cause 4: Custom Apex or Flow nulls Order Product fields before activation
1. Navigate to Setup > Apex Classes and review any class that updates OrderItem records — for example any class that sets ServiceDate, SBQQ__SubscriptionPricing__c, or date fields to null. Per Salesforce Billing automation guidance, ensure CPQ and Billing triggers on the Order object have finished before your automation activates the order.
2. Modify the custom Apex or Record-Triggered Flow so it does not null out date fields, Quote Line lookups [SBQQ__QuoteLine__c], or Subscription Pricing [SBQQ__SubscriptionPricing__c] on Order Products before the SBQQ trigger runs.
3. If you must run contracting on a large volume of Order Products, navigate to Setup > Installed Packages > Salesforce CPQ > Configure > Subscriptions and Renewals and deselect Contract in Foreground to use asynchronous contracting.

After applying the relevant fix, confirm the issue is resolved by reopening the affected Order, selecting the Contracted [SBQQ__Contracted__c] checkbox (or setting Status to Activated), saving the record, and verifying that the save completes without the NullPointerException and that a Contract [Contract] and Subscriptions [SBQQ__Subscription__c] are generated.

Knowledge Article Number

005385058

 
Loading
Salesforce Help | Article