You need to sign in to do that
Don't have an account?
Devon Bernard
PHP Toolkit Query Returns Invalid Rows
I'm trying to run a basic query like:
$query = "SELECT Id, Name, CommunityNickname from User";
For each row I would expect this Query to return an object like:
stdClass Object ( [type] => User [Id] =>000a00000000AAaAAZ [Name] => John Doe [CommunityNickName]=>SomeGuy )
But instead I'm being returned an object like this:
stdClass Object ( [type] => User [Id] => Array ( [0] => 000a00000000AAaAAZ [1] => 000a00000000AAaAAZ ) [any] => John DoeSome Guy )
Apparently whats happening is the Id value is an array with the Id twice, and instead of organized row columns I'm getting one massive column called "any" that just combines every column that I searched for.
I have no idea why these columns would ever be combined into an indesipherable column called any making the data completely un-parsable. I'm using PHP Toolkit Version 20.0 and copied the starter-guide only to recieve this error. I've also tried using both a customly generated Partner wsdl and the one that is provided default with the soapClient. The example code I'm using comes directly from https://wiki.developerforce.com/page/Getting_Started_with_the_Force.com_Toolkit_for_PHP ("Executing a Query" Section) and should be really trivial but I don't know why this bug is occuring.
Any guidance or assistance with this issue would be greatly appreciated.
$query = "SELECT Id, Name, CommunityNickname from User";
For each row I would expect this Query to return an object like:
stdClass Object ( [type] => User [Id] =>000a00000000AAaAAZ [Name] => John Doe [CommunityNickName]=>SomeGuy )
But instead I'm being returned an object like this:
stdClass Object ( [type] => User [Id] => Array ( [0] => 000a00000000AAaAAZ [1] => 000a00000000AAaAAZ ) [any] => John DoeSome Guy )
Apparently whats happening is the Id value is an array with the Id twice, and instead of organized row columns I'm getting one massive column called "any" that just combines every column that I searched for.
I have no idea why these columns would ever be combined into an indesipherable column called any making the data completely un-parsable. I'm using PHP Toolkit Version 20.0 and copied the starter-guide only to recieve this error. I've also tried using both a customly generated Partner wsdl and the one that is provided default with the soapClient. The example code I'm using comes directly from https://wiki.developerforce.com/page/Getting_Started_with_the_Force.com_Toolkit_for_PHP ("Executing a Query" Section) and should be really trivial but I don't know why this bug is occuring.
Any guidance or assistance with this issue would be greatly appreciated.
Hi ,
Try something like this,
$query = "SELECT C.Id, C.FirstName, C.LastName, C.Email FROM Contact C WHERE C.Email = '*******@gmail.com'";
$response = $mySforceConnection->query($query);
foreach ($response as $record) {
$sObject = new SObject($record);
print_r($sObject);
}
http://stackoverflow.com/questions/15698362/trouble-with-salesforce-query-results-php-toolkit
Also See,
SalesForce.com: Retrieve custom fields via PHP
http://stackoverflow.com/questions/5734033/salesforce-com-retrieve-custom-fields-via-php
See the blog,
Salesforce Toolkit for PHP
http://www.shivasoft.in/blog/salesforce/salesforce-toolkit-for-php/
Force.com Toolkit for PHP
http://www.jonholato.com/2012/07/26/force-com-toolkit-for-php/
Regards,
Ashish