SAP Cloud Platform Open Connectors

Querying Numeric Fields

When querying for numeric field values in Salesforce Sales Cloud there is an important aspect of the vendor functionality to keep in mind. If you attempt to query for a field value that is technically larger than type integer can store then you will receive an error "For input string" and no records are returned.

The reason for this error is that in Salesforce queries an integer cannot be bigger than 2^31-1 (2,147,483,647); Salesforce queries (SOQL) interpret field values up to 2^31-1 as 'numbers', but values from 2^31 and greater are regarded as strings. This is an aspect of Salesforce query functionality, but fortunately there is a workaround that you can use. To get Salesforce to accept your query for these large field values you must append .0 to the end of the value, which defines the value as type decimal, which can be up to 2^63-1, and your query will be interpreted by SOQL as a number instead of a string.

For example: When querying numeric field values in a SFDC endpoint you should use a query such as `where customField__TicketID__c=7010965773.0` when the field value is greater than 2^31-1.