Opportunity custom fields are missing via DataService query for few records even though the value is present in the UI. That particular custom field name(CustomXXX) is included in the select field. The same query I used to query another opportunity, I got the value for CustomXXX. Below is the query I used for both API calls. The only change is the value given for “OpportunityTitle”
> <?xml version="1.0"?>
> <methodCall>
> <methodName>DataService.query</methodName>
> <params>
> <param>
> <value>
> <string>XXXX</string>
> </value>
> </param>
> <param>
> <value>
> <string>Lead</string>
> </value>
> </param>
> <param>
> <value>
> <int>100</int>
> </value>
> </param>
> <param>
> <value>
> <int>0</int>
> </value>
> </param>
> <param>
> <value>
> <struct>
> <member>
> <name>OpportunityTitle</name>
> <value>
> <string>123 - Opportunity XXX</string>
> </value>
> </member>
> </struct>
> </value>
> </param>
> <param>
> <value>
> <array>
> <data>
> <value>
> <string>AffiliateId</string>
> </value>
> <value>
> <string>ContactID</string>
> </value>
> <value>
> <string>EstimatedCloseDate</string>
> </value>
> <value>
> <string>LastUpdatedBy</string>
> </value>
> <value>
> <string>_CustomXXX</string>
> </value>
> </data>
> </array>
> </value>
> </param>
> <param>
> <value>
> <string>LastUpdated</string>
> </value>
> </param>
> <param>
> <value>
> <boolean>0</boolean>
> </value>
> </param>
> </params>
> </methodCall>