Symptom
When querying orders via the CloudSense Ecommerce API, a field that is configured in the ObjectGraph Callout Strategy returns no data:
curl --location 'https://cs-ecommerce-sandbox-eu-app.cloudsense.com/services/current/orders/account/<ACCOUNT_ID>/search?limit=100' \
--header 'Accept: application/json' \
--header 'CS-Time: <TIMESTAMP>' \
--header 'Authorization: <TOKEN>' \
--header 'Content-Type: application/json' \
--header 'CS-Signature: <SIGNATURE>' \
--data '{ "searchFields": [] }'
The response includes other fields but the specific field (e.g., CS_Order_Subtype__c) is missing or null, even though:
- The field exists on the Order object in Salesforce
- The field is populated with data
- The field is listed in the ObjectGraph Callout Strategy
Cause
The CloudSense Ecommerce service is case-sensitive when mapping fields from the ObjectGraph Callout Strategy to the Elasticsearch index. If the field name in the strategy does not match the exact casing of the Salesforce field API name, the field will not be synced.
Example mismatch:
- ObjectGraph Callout Strategy: CS_Order_Subtype__c (lowercase 't' in "type")
- Actual Salesforce Field API Name: CS_Order_SubType__c (capital 'T' in "Type")
The service attempts to query a field that doesn't exist (due to case mismatch), resulting in no data being synced to Elasticsearch.
This issue typically affects:
- Custom fields added after initial ObjectGraph Callout Strategy configuration
- Fields added via manual entry (typos in casing)
- Fields copied from documentation or other sources with incorrect casing
Resolution
Step 1: Identify the Field Name Mismatch
- Navigate to Setup > Object Manager > Order (or the affected object)
- Click Fields & Relationships
- Search for the field in question (e.g.,
CS_Order_Subtype) - Note the exact Field Name (API Name) including casing
Example:
- Field Label: CS Order SubType
- Field Name: CS_Order_SubType__c (note the capital 'T')
Step 2: Locate the ObjectGraph Callout Strategy
- In Salesforce Setup, search for "Custom Metadata Types"
- Navigate to ObjectGraph Callout Strategy
- Click Manage Records
- Find the record for the Order object
- Open the record for editing
Alternatively, navigate directly via URL:
https://<instance>.lightning.force.com/lightning/r/csam__ObjectGraph_Callout_Strategy__c/<RECORD_ID>/view
Step 3: Correct the Field Name Casing
In the ObjectGraph Callout Strategy record, locate the field configuration (typically in a JSON or comma-separated list of fields).
Before:
{
"fields": [
"Id",
"Name",
"CS_Order_Subtype__c",
"csord__Status2__c"
]
}
After:
{
"fields": [
"Id",
"Name",
"CS_Order_SubType__c",
"csord__Status2__c"
]
}
Save the record.
Step 4: Trigger Re-Sync (If Needed)
Depending on your configuration, the Ecommerce service may automatically pick up the change. If not, trigger a re-sync:
- Navigate to an Order record
- Make a minor update (e.g., add a note or update a non-critical field)
- Save the record
- This triggers the ObjectGraph Callout to re-sync the order
Alternatively, if you have access to the Ecommerce service admin interface, trigger a manual re-index for the affected org.
Step 5: Verify the Fix
Re-run the API query and verify the field now appears in the response:
curl --location 'https://cs-ecommerce-sandbox-eu-app.cloudsense.com/services/current/orders/account/<ACCOUNT_ID>/search?limit=100' \
--header 'Accept: application/json' \
--header 'Authorization: <TOKEN>' \
--data '{ "searchFields": [] }'
Check the response JSON for the field:
{
"orders": [
{
"Id": "a2W...",
"Name": "ORD-12345",
"CS_Order_SubType__c": "Renewal",
...
}
]
}
Step 6: Review All Fields in Strategy
To prevent similar issues, audit all fields in the ObjectGraph Callout Strategy:
- Export the list of fields from the strategy
- For each field, verify the exact API name in Salesforce Object Manager
- Correct any casing mismatches
- Save and test
Additional Notes
- Case Sensitivity: Salesforce field API names are case-sensitive when accessed programmatically. Always use the exact casing from the Object Manager.
- Historical Data: Correcting the field name will only affect future syncs. Historical orders in Elasticsearch will not be retroactively updated unless a full re-index is triggered.
- Multiple Objects: If you have ObjectGraph Callout Strategies for multiple objects (Account, Subscription, etc.), audit all of them for case sensitivity issues.
- Field List: To see which fields are currently synced, check the Ecommerce service logs or query the Elasticsearch index directly (if you have access).
- Common Fields with Casing Issues:
CS_Order_SubType__cvsCS_Order_Subtype__ccsord__Order_Number__cvscsord__order_number__c- Custom fields with mixed casing (e.g.,
MyField__cvsMyfield__c)
Prevention
- When adding new fields to ObjectGraph Callout Strategy, always copy the API name directly from Salesforce Object Manager
- Use Salesforce Inspector or similar tools to verify exact field names before adding them to strategies
- Document field API names in a central location for reference
- Test API responses after adding new fields to confirm they sync correctly
Priyanka Bhotika
Comments