Start a conversation

Order and Subscription Not Created on Close Won Due to Wrong Basket Record Type

Symptom

When an Opportunity is set to "Closed Won", the Order Generation process does not trigger. No Order, Subscription, or Service records are created. Running csordtelcoa.API_V1.generateOrdersFromOpportunities() from Anonymous Apex returns no errors but also does not create any Order.

Cause

The Product Basket linked to the Opportunity has the wrong record type. Specifically, the basket has the "In-flight Change" record type instead of the standard basket record type.

Baskets with the "In-flight Change" record type are designed for MACD change operations, not for new order generation. The generateOrdersFromOpportunities API skips baskets with this record type because they follow a different processing path (inflight change flow instead of the standard order generation flow).

Resolution

Step 1: Check the basket record type

Query the basket linked to the affected Opportunity:

SELECT Id, Name, RecordType.Name, RecordTypeId
FROM cscfga__Product_Basket__c
WHERE cscfga__Opportunity__c = '<OPPORTUNITY_ID>'

If RecordType.Name is "In-flight Change", this confirms the issue.

Step 2: Determine how the basket was created

Review the process that created the basket. Baskets for new orders should use the standard record type, not the "In-flight Change" record type. Common causes of incorrect record type assignment:
- Incorrect Apex code or automation that creates baskets with the wrong record type
- Manual basket creation using the wrong record type
- Data migration that assigned the wrong record type ID

Step 3: Correct the basket record type

Update the basket's record type to the standard basket record type. You can find the correct record type ID by querying a working basket:

SELECT Id, RecordType.Name, RecordTypeId
FROM cscfga__Product_Basket__c
WHERE RecordType.Name != 'In-flight Change'
LIMIT 1

Step 4: Retry order generation

After correcting the record type, set the Opportunity back to "Closed Won" (or re-trigger the order generation API) and verify that Orders, Subscriptions, and Services are created.

Additional Notes

  • The "In-flight Change" record type is reserved for MACD baskets created through the inflight change flow. Do not use it for new order baskets.
  • If this issue occurs systematically, review any Apex triggers, Process Builder flows, or custom code that creates baskets to ensure the correct record type is assigned
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted

Comments