Problem
When attempting to push a Programmatic Order to Google Ad Manager (GAM), the operation fails with the following error:
NotNullError.NULL @ [0].primaryTrafficker
This error indicates that GAM is receiving a null or missing value for the Primary Trafficker field, which is a required field for Order creation in GAM. The push fails and the Order cannot be delivered to the Ad Server.
Root Cause
The Primary Trafficker value is stored correctly in Salesforce on the Fulfilment record, but it is being dropped or not serialized during the hand-off from CloudSense to Google Ad Manager.
Common causes include:
- Outdated or Customized Mapping File: The
fulfilmentStrategy.jsonfile may be missing theprimaryTraffickerIdmapping or has it wrapped in a conditional that evaluates to false - Default Trafficker Settings Enabled: The Ad Server record has "Use default trafficker when missing" options enabled, which may interfere with the mapping
- User Inactive or Deleted in GAM: The Primary Trafficker user exists in Salesforce but is inactive or deleted in Google Ad Manager
- Payload Serialization Issue: The CloudSense serialization logic is not correctly extracting the Primary Trafficker ID from the Fulfilment record
Resolution Steps
Step 1: Verify the Fulfilment Strategy Mapping File
- Locate the fulfilmentStrategy.json file in your Salesforce org:
- Navigate to Setup > Static Resources
- Search for your GAM fulfilment strategy static resource (e.g., "FulfilmentStrategy_GAM")
-
Download and open the JSON file
-
Check the Order or Proposal mapping block for the
primaryTraffickerIdfield:
{
"order": {
"enabled": true,
"engine": "JavaScript",
"mapExpression": "{\n primaryTraffickerId: parseInt(fulfilment.getPrimaryTrafficker().getAdServerId()),\n // ... other mappings\n}"
}
}
- Verify the mapping is present and not wrapped in a conditional:
- The line should be:
primaryTraffickerId: parseInt(fulfilment.getPrimaryTrafficker().getAdServerId()) - If missing, add it to the mapExpression
-
If wrapped in a conditional (e.g.,
if (condition) { primaryTraffickerId: ... }), ensure the condition evaluates to true -
If you made changes, redeploy the static resource:
- Upload the updated JSON file to the Static Resource
- Clear any caching if applicable
Step 2: Check Ad Server Settings
- Navigate to the Ad Server record in Salesforce:
- Go to the Ad Server object (e.g.,
csdf__Ad_Server__c) -
Open the GAM Ad Server record (e.g., record ID
a1p58000000P86yAAC) -
Verify the Default Trafficker settings:
- Locate the following checkboxes:
- Default Trafficker
- Force default trafficker
- Ensure both checkboxes are UNCHECKED (OFF)
-
If either is checked, uncheck it and save the record
-
Why this matters: When these options are enabled, they may override or interfere with the Primary Trafficker mapping from the Fulfilment record
Step 3: Confirm the User Exists in Google Ad Manager
-
Log in to Google Ad Manager with administrator credentials
-
Navigate to Admin > Users
-
Search for the Primary Trafficker:
- Search by Ad Server ID (e.g.,
245089265) -
Or search by email (e.g.,
valeria.benvenuto@ilsole24ore.com) -
Verify the user status:
- If the user is inactive or deleted, reactivate or recreate the user in GAM
-
Ensure the user has appropriate permissions for trafficking
-
Note the user's ID and confirm it matches the Ad Server ID stored in Salesforce
Step 4: Re-Push the Fulfilment
-
Open the Fulfilment record in Salesforce (e.g.,
F-0036202) -
Click "Push to Ad Server" to retry the push operation
-
Monitor the Outgoing Message log:
- Navigate to the related Outgoing Message record
- Check the Notes & Attachments section for the JSON payload file
-
Verify that
primaryTraffickerIdis present and has a valid numeric value -
If the push succeeds, verify the Order in GAM to confirm the Primary Trafficker is correctly assigned
-
If the push still fails:
- Download the Outgoing Message JSON file
- Check if
primaryTraffickerIdis present in the payload - Review the complete API fault string for additional clues
- Contact CloudSense Support with the JSON file and fault details
Verification
After completing the resolution steps, verify the fix:
- Check the Fulfilment record in Salesforce:
- Confirm the Primary Trafficker field is populated
-
Note the Ad Server ID value
-
Review the Outgoing Message JSON:
- Open the most recent Outgoing Message record
- Download the JSON payload from Notes & Attachments
-
Search for
"primaryTraffickerId"and confirm it has a numeric value (not null) -
Verify in Google Ad Manager:
- Log in to GAM
- Navigate to the Order
- Confirm the Primary Trafficker is correctly assigned
Temporary Workaround
If the Order is time-critical and the above steps require additional investigation:
- Manually set a default Primary Trafficker in the Ad Server settings (as a temporary measure)
- Push the Order to GAM
- Manually update the Primary Trafficker in GAM after the Order is created
- Revert the default setting and implement the proper fix to prevent future occurrences
Prevention
To prevent this issue in future implementations:
- Always include the primaryTraffickerId mapping in fulfilmentStrategy.json for GAM integrations
- Avoid conditional logic around required GAM fields unless absolutely necessary
- Test fulfilment pushes in a sandbox environment after any changes to fulfilment strategy files
- Maintain user synchronization between Salesforce and GAM to ensure all traffickers exist in both systems
- Document any customizations to the fulfilment strategy mapping for future reference
Important Notes
- The Primary Trafficker is a required field for GAM Orders and cannot be null
- This issue can occur with both Programmatic Guaranteed and Direct Orders
- Changes to the fulfilmentStrategy.json require redeploying the Static Resource
- If you have multiple Ad Server records, ensure the correct one is being used for the push
- The error may also occur if the Ad Server ID stored in Salesforce does not match the actual user ID in GAM
Priyanka Bhotika
Comments