function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ringnengringneng 

PHP Toolkit query() question: Doesn't return all fields I query for.

Hi guys, I'm using the PHP Toolkit to create an application.

 

I've stumbled upon this issue several times, it's fixed itself magically the previous times, but it's starting to become a hassle and I'd like to have a logical explanation as to why it happens.

 

Say I have a custom object named User__c. If I add custom fields to this object, I'll need to update my metadata and my enterprise WSDL for the queries to fetch the info on the new fields.

 

When I do this, the first 24 hours the query will not return the field. After that it magically reads it. I've waited past this period... and still my code turns no results.

 

If I run the query using the Force Explorer tool, I can see the data just fine.

 

Maybe I'm forgetting config steps in Salesforce? It's driving me insane.

 

Here is my code.

 

$query = "SELECT Id, FirstName__c, LastName__c, Email__c, User_Role__c, Account__c, Location__c, Address_Line_1__c, Address_Line_2__c, City__c, Country__c, State__c, Postal_Code__c, Telephone_Number__c From User__c where Id = 'a2Le00000000Bk4EAE'";
$response = $connection->query($query);

 

I should see all the fields, but when I do a var_dump of the $response->records object, I get everything, except Address_Line_1__c, Line_2__c, City, State, and all the fields I added a few days ago.

 

{ 
["Id"]=> string(18) "a2Le00000000Bk4EAE" 
["Account__c"]=> string(18) "001e0000003LBG4AAO" 
["Email__c"]=> string(21) "stef.TASTAN@GMAIL.COM" 
["FirstName__c"]=> string(9) "ESTEFANIA" 
["LastName__c"]=> string(4) "COOL" 
["Location__c"]=> string(18) "a0Se0000000A5bCEAS" 
["User_Role__c"]=> string(12) "Account-wide" 
}

 

Hope someone can help. I'm going insane here :c

 

AdminBoosterAdminBooster

Not really answering your question but the workaround could be using the partner API instead of the enterprise API. Force Explorer, Dataloader and other tools are using the partner API

Jess_LopezJess_Lopez

The WSDL file gets cached. After you upload the new WSDL file, delete the cached WSDL file and your code will look for and cache the new WSDL. On the Linux machine I'm using, the file is located in the /tmp directory.