You need to sign in to do that
Don't have an account?

PHP Toolkit 13.1: Formula fields are not returned by SELECT SOQL statement
I'm passing in a SalesForce session ID and session URL to an Intranet page as a means of authenticating the current user.
This is the code I am using for that:
require_once (SALESFORCE_SOAPCLIENT_BASEDIR.'/SforceEnterpriseClient.php'); $mySforceConnection = new SforceEnterpriseClient(); $mySoapClient = $mySforceConnection->createConnection(SALESFORCE_SOAPCLIENT_URL.'/enterprise.wsdl.xml'); $mySforceConnection->setSessionHeader($sessionId);
$mySforceConnection->setEndpoint($sessionUrl);
That successfully logs in the current user, now I want to try to pull some contact records from the database, so I use this code:
$contactResult = $mySforceConnection->query("SELECT Formula_Field_Name__c, Name, Id FROM Contact LIMIT 50"); if (count($contactResult->records)) { foreach ($contactResult->records as $record) { echo '<pre>'; print_r($record); echo '</pre><hr>'; } }
In the print_r output, I'll get Name and Id -- but the Formula field is no where to be found. At first I thought maybe I didn't spell it correctly, so I tried adding random characters to the fieldname to ensure it would create an error, which id did. So I know I am spelling the field correct, I just can't get it to show up in the results.
The host I am on is using PHP 5.2.6, can someone exaplain what I need to do to fix this? Any help is much apprciated.
Mystery solved! My enterprise wsdl was getting cached by PHP. I used ini_set('soap.wsdl_cache_enabled', '0'); and everything is working now.
All Answers
Mystery solved! My enterprise wsdl was getting cached by PHP. I used ini_set('soap.wsdl_cache_enabled', '0'); and everything is working now.
how did you use the "ini_set('soap.wsdl_cache_enabled', '0');"? i think i maybe getting the same problem.