Start a conversation

Duplicate Add-Ons in Revamp Basket Creation

Problem

When creating a revamp basket for a MACD (Move, Add, Change, Delete) operation, duplicate add-on services appear in the basket even though no duplicate add-ons exist at the service level. This issue persists even after creating a new revamp basket.

Root Cause

The issue occurs because the SOQL query in the custom SolutionActionHelper.fetchExistingAddOns method fetches add-on services from multiple parent services with different statuses. Specifically, when a service is being replaced, there are typically two service records:
- One with status "In Replacement" (the service being replaced)
- One with status "In Progress" (the replacement service)

Both service records have active add-ons associated with them. The current SOQL query fetches add-ons from both parent services, resulting in duplicates appearing in the revamp basket.

Diagnosis Steps

  1. Identify the Affected Services: Note the external IDs of the services showing duplicate add-ons in the revamp basket (e.g., 60126002957, 60126002354).

  2. Query for Parent Services: Run the following SOQL query to check if multiple parent service records exist for each external ID:
    sql SELECT Id, Name, External_ID__c, csord__Status__c, csordtelcoa__Replacement_Service__c FROM csord__Service__c WHERE External_ID__c IN ('60126002957', '60126002354') ORDER BY External_ID__c, CreatedDate

  3. Check Add-On Services: For each parent service found, query for associated add-on services:
    sql SELECT Id, Name, csord__Service__c, csord__Service__r.csord__Status__c, csord__Status__c, csordtelcoa__Product_Configuration__r.Add_On__c FROM csord__Service__c WHERE csord__Service__r.External_ID__c IN ('60126002957', '60126002354') AND csord__Status__c = 'Active' AND csordtelcoa__Product_Configuration__r.Add_On__c = true ORDER BY csord__Service__r.External_ID__c, Name

  4. Verify Status Mismatch: Check if you find:

  5. Multiple parent services for the same external ID
  6. One parent with status "In Replacement" and another with status "In Progress"
  7. Active add-ons associated with both parent services

Resolution

Immediate Fix

Update the service status for the "In Progress" parent service to "Replaced":

  1. Navigate to the parent service record with status "In Progress" (the one that should have been replaced).
  2. Update the csord__Status__c field from "In Progress" to "Replaced".
  3. Save the record.
  4. Create a new revamp basket and verify that duplicate add-ons no longer appear.

Long-Term Fix (Custom Code Update)

If your organization uses a custom SolutionActionHelper class with a fetchExistingAddOns method, update the SOQL query to fetch active add-ons only from the parent service with status "In Replacement":

Current SOQL (fetches from both "In Replacement" and "In Progress"):

SELECT Id, Name, csordtelcoa__Product_Configuration__r.Add_On__c,
       csordtelcoa__Product_Configuration__r.Commercial_Product__c,
       csordtelcoa__Replaced_Service__c,
       csordtelcoa__Replacement_Service__c,
       csord__Service__c,
       csord__Service__r.csord__Status__c
FROM csord__Service__c
WHERE csord__Service__r.External_ID__c = :serviceId
  AND csord__Status__c = 'Active'
  AND csord__Service__r.csordtelcoa__Replacement_Service__c = NULL
  AND csord__Service__r.csord__Status__c != 'Replaced'

Suggested SOQL (fetches only from "In Replacement"):

SELECT Id, Name, csordtelcoa__Product_Configuration__r.Add_On__c,
       csordtelcoa__Product_Configuration__r.Commercial_Product__c,
       csordtelcoa__Replaced_Service__c,
       csordtelcoa__Replacement_Service__c,
       csord__Service__c,
       csord__Service__r.csord__Status__c
FROM csord__Service__c
WHERE csord__Service__r.External_ID__c = :serviceId
  AND csord__Status__c = 'Active'
  AND csord__Service__r.csordtelcoa__Replacement_Service__c = NULL
  AND csord__Service__r.csord__Status__c = 'In Replacement'

The key change is in the last line: csord__Status__c = 'In Replacement' instead of != 'Replaced'.

Prevention

  • Service Status Management: Ensure that when a service is replaced, the old service status is updated to "Replaced" and not left as "In Progress".
  • SOQL Query Review: If using custom SOQL queries to fetch add-ons during MACD operations, ensure the query filters for the correct parent service status to avoid fetching from multiple service records.
  • Data Validation: Before creating revamp baskets, verify that only one active parent service exists for each external ID, or that the service statuses correctly reflect the replacement lifecycle.
  • Custom Class: SolutionActionHelper
  • Method: fetchExistingAddOns
  • Service Status Values: "In Progress", "In Replacement", "Replaced"
  • Related Objects: csord__Service__c, csordtelcoa__Product_Configuration__c
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted

Comments