+ Start a Discussion
Chris MacdonaldChris Macdonald 

API Fails to Get Boolean Values of Custom Object

I posted this on the Stack Exchange but haven't got much of a response there (after bountying it too). I have the following query:
 

SELECT Column1__c, Column2__c, Column3__c, Column4__c, Column5__c, Column6__c FROM Table__c where Column5__c >= 2016-09-29
 



Columns1 and Column2 fail to return data for me. If I execute the same query in WorkBench it works fine so I think it must be a setting I'm missing. Column1 and Column2 are booleans. I'm using the PHP Tool Kit version 20.

API Code:
 

try {
    $salesforce = new SforceEnterpriseClient();
    $salesforce->createConnection('salesforce_connector/soapclient/enterprise.wsdl.xml');
    $salesforce->login('user', 'pass');
    $query = 'SELECT Column1__c, Column2__c, Column3__c, Column4__c, Column5__c, Column6__c
    FROM Table__c
    where Column3__c >= ' . date('Y-m-d');
    $options = new QueryOptions(2000);
    $salesforce->setQueryOptions($options);
    $response = $salesforce->query($query);
    die(print_r($response));
 



Response:

 

[1878] => SObject Object ( 
     [type] => 
     [fields] => 
     [Column3__c] => 2016-12-31 
     [Column4__c] => 0022000000abcHcAAI 
     [Column5__c] => 43892 
     [Column6__c] => 2013-06-01 
)
Karthik PKarthik P
Chris,

When you queried in the workbench, did you use the same username and password to execute the query ? I am not sure about this, but does the user has field level permissions on these 2 fields ?

 
Chris MacdonaldChris Macdonald
Yes, I've used the same account in WorkBench and the API.