Start a conversation

Fix: Extension Period MACD Fails with csordcb Null Pointer (Invalid Observer Metadata)

Overview

When creating an Extension Period MACD order in Salesforce (including via anonymous Apex) using csordtelcoa.API_V1.addSubscriptionsToMacOpportunity(List<Id> subscriptionIds, Id opportunityId, Boolean processAsync), the transaction may fail with System.NullPointerException: Attempt to de-reference a null object in the csordcb namespace.

A confirmed cause is an invalid CloudSense observer registration: a record in csordcb__Observer__mdt references an Apex class name in csordcb__Class_Name__c that does not exist in the org. Correcting or removing the invalid observer entry allows the MACD flow to complete successfully.

Solution

Error Signature

You may see an exception during Extension Period MACD / new order creation such as:

  • System.NullPointerException: Attempt to de-reference a null object (namespace csordcb)

Often reported while calling:

  • csordtelcoa.API_V1.addSubscriptionsToMacOpportunity(List<Id> subscriptionIds, Id opportunityId, Boolean processAsync)

When This Occurs

This pattern can occur during CloudSense observer processing, where CloudSense loads observer registrations from custom metadata and attempts to instantiate and dispatch them.

Root Cause (Confirmed)

An entry in the CloudSense Observer custom metadata type csordcb__Observer__mdt contains a value in csordcb__Class_Name__c that references an Apex class not present in the org.

Example observed: CSMassMacdJobStatusHandler was referenced by an observer record, but the Apex class did not exist.

Diagnosis

  1. Run the following SOQL query (Developer Console / VS Code + Salesforce extension / Workbench):

    select Id, DeveloperName, csordcb__Class_Name__c
    from csordcb__Observer__mdt
    order by SystemModstamp desc
  2. For each returned csordcb__Class_Name__c value, verify the Apex class exists in the org (Setup → Apex Classes, or by querying ApexClass by name).

  3. Identify any observer entries where csordcb__Class_Name__c is populated but the corresponding Apex class is missing.

Resolution

Choose the option that best matches your implementation.

Option A (Common): Remove or Correct the Invalid Observer Registration

  1. Go to Setup → Custom Metadata Types.
  2. Locate the type Observer (API name: csordcb__Observer__mdt) and open Manage Records.
  3. Find the observer record whose csordcb__Class_Name__c points to a missing Apex class.
  4. Delete that custom metadata record, or update it to reference a valid class (if appropriate for your configuration).
  5. Retry the Extension Period MACD action or re-run addSubscriptionsToMacOpportunity(...).

Option B: Restore/Deploy the Missing Apex Class

If the observer is expected to run in your org (for example, it is part of a customization package you maintain), deploy/restore the missing Apex class so it matches the metadata registration, then retry the MACD flow.

Verification

  • Re-run the same operation that previously failed (UI-driven Extension Period MACD order creation, or the same anonymous Apex invocation of csordtelcoa.API_V1.addSubscriptionsToMacOpportunity(...)).
  • Confirm the process completes without System.NullPointerException: Attempt to de-reference a null object in the csordcb namespace.

Notes / Cautions

  • Only remove an observer registration if it is not required for your business flow. If it is required, restoring the missing class is typically the safer approach.
  • If behavior differs across orgs (for example, UAT works but a sandbox fails), compare csordcb__Observer__mdt records and the presence of referenced Apex classes across those orgs.

Frequently Asked Questions

1. How can I tell if my null pointer is caused by observer metadata?

If the error is System.NullPointerException: Attempt to de-reference a null object in namespace csordcb during MACD/order creation, run:

select Id, DeveloperName, csordcb__Class_Name__c
from csordcb__Observer__mdt
order by SystemModstamp desc

Then confirm every csordcb__Class_Name__c exists as an Apex class in the org. Any missing class is a strong indicator.

2. What do I do if I find an observer pointing to a missing class?

Either (1) remove/update the corresponding csordcb__Observer__mdt record so it no longer references the missing class, or (2) deploy/restore the missing Apex class (preferred if the observer is needed).

3. What if all classes referenced in csordcb__Observer__mdt exist, but the error persists?

Capture a fresh debug log for the failing transaction and proceed with deeper analysis of the csordcb observer dispatch path. Include the output of the observer query above and the timestamp of the failing run.

4. How do I verify the fix worked?

Re-run the same Extension Period MACD flow (or the same addSubscriptionsToMacOpportunity(...) call) and confirm the transaction completes without the csordcb null pointer exception.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Matej Storga

  2. Posted
  3. Updated

Comments