Symptom
A GAM (Google Ad Manager) Sales Order shows "Unknown Error - Contact your System Administrator" when submitted or refreshed. The error occurs during the integration between CloudSense Digital Fulfilment and GAM.
Additionally, clicking "Refresh from Ad Server" on the parent Fulfilment record may result in an Apex CPU time limit exceeded error.
Cause
Two issues can contribute to this error:
-
Duplicate Fulfilment Item records: Multiple
csdf__Fulfilment_Item__crecords exist for the same Product Configuration on a single Fulfilment. The custom triggerCS_FulfilmentItemTriggerattempts to build a list of PC IDs from the Fulfilment Items, and when duplicate IDs are encountered, it throwsSystem.ListException: Duplicate id in list. -
Excessive Geo-Targeting records: A very large number of
csdf__Geo_Targeting__crecords linked to the Fulfilment Items (e.g., 13,000+) can cause CPU timeout when the system processes them during a bulk refresh operation.
Resolution
Step 1: Check for duplicate Fulfilment Items
Query the Fulfilment Items for the affected Fulfilment record:
SELECT Id, Product_Configuration__c, CreatedDate,
csdf__Fulfilment_Item_Link__c
FROM csdf__Fulfilment_Item__c
WHERE csdf__Fulfilment__c = '<FULFILMENT_ID>'
ORDER BY Product_Configuration__c
Look for multiple rows with the same Product_Configuration__c value. Each PC should have only one Fulfilment Item.
Step 2: Delete duplicate Fulfilment Items
Delete the duplicate Fulfilment Item records, keeping only one per Product Configuration. Use the CreatedDate to determine which is the original.
Step 3: Check geo-targeting record count
If the refresh is timing out, check the total geo-targeting records:
SELECT csdf__Fulfilment_Item__c, COUNT(csdf__Geo_Item__c)
FROM csdf__Geo_Targeting__c
WHERE csdf__Fulfilment_Item__c IN (<FULFILMENT_ITEM_IDS>)
GROUP BY csdf__Fulfilment_Item__c
If the total count is very high (10,000+), refreshing all Fulfilment Items at once will exceed the CPU timeout.
Step 4: Refresh Fulfilment Items individually
Instead of using the "Refresh from Ad Server" button on the parent Fulfilment (which processes all FIs at once), refresh each Fulfilment Item individually to avoid the CPU timeout.
Step 5: Resubmit the order
After cleaning up duplicates and refreshing individually, resubmit the Sales Order.
Additional Notes
- This issue is specific to the CloudSense Digital Fulfilment (Media) module and GAM integration
- Duplicate Fulfilment Items can be created by automation or integration logic that runs multiple times for the same PC
- For Sales Orders with very large geo-targeting data sets, always refresh Fulfilment Items individually rather than in bulk
Priyanka Bhotika
Comments