2

I'm currently only able to retrieve non-boolean columns from a SOQL query when using the SforceEnterpriseClient. In the below query Columns1 and Column2 fail to return data to me.

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

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.

Full code usage:

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 (Single example):

[1878] => SObject Object
            (
                [type] => 
                [fields] => 
                [Column3__c] => 2016-12-31
                [Column4__c] => 0022000000abcHcAAI
                [Column5__c] => 43892
                [Column6__c] => 2013-06-01
            )
6
  • 2
    Has the SforceEnterpriseClient been updated more recently than 2009? developer.salesforce.com/page/PHP_Toolkit_11.0_Getting_Started ... after looking, it appears the Force.com Toolkit for PHP is currently at v20 is this the version you're using? developer.salesforce.com/page/PHP_Toolkit
    – Mark Pond
    Commented Sep 29, 2016 at 21:20
  • Yes, our SforceBaseClient.php has protected $version = '20.0';.
    – chris85
    Commented Sep 29, 2016 at 21:38
  • Apologies for pointing out the obvious, but we all miss the obvious sometimes: Are you using the same user credentials in your PHP and Workbench test? If not, it could be worth checking the field-level security.
    – Aidan
    Commented Oct 4, 2016 at 8:10
  • @Aidan For Field-level security it is set to visible for all users. The only other option there is read-only though so maybe I'm looking at the wrong place? I'm in Custom Field Definition Detail.
    – chris85
    Commented Oct 4, 2016 at 14:09
  • Again, sorry to be going through the obvious, but I'm pretty sure there's no fundamental problem with getting booleans from PHP toolkit. Do you have the latest version of the Enterprise WSDL i.e. does it have those fields you're missing included in it?
    – Aidan
    Commented Oct 4, 2016 at 14:51

1 Answer 1

1

I strongly suspect that there is something wrong with enterprise WSDL. possible options to check are:

  • Check if the WSDL is latest or not
  • Check the path of WSDL - its possible that you may be checking at X path and code is referring Y path.

If non of above help to identify issue then next thing to try is replace Enterprise WSDL with Partner WSDL and run your code.

2
  • The paths are correct. The createConnection is an absolute path in deployment. I've updated the Enterprise WSDL to one downloaded today. The issue remains the same though. I'm not see the Partner WSDL
    – chris85
    Commented Oct 5, 2016 at 19:28
  • 1
    After adding 2 new fields to the object, regenerating another WSDL, then using ini_set("soap.wsdl_cache_enabled", "0");, this now works. So seems WSDL was somehow related, not sure why the first update didnt work though.
    – chris85
    Commented Oct 27, 2016 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .