You need to sign in to do that
Don't have an account?
ryanhca123
Using AggregateResult query in PHP Toolkit gives error
I'm trying to run the following code and I'm getting the error shown below...
$conn = Salesforce::connect(); $active_users_query = "Select COUNT(Id) active_users From User Where isActive=true AND UserType = 'Standard'"; $a = $conn->query($active_users_query); print_r($a);
error:
Warning: Invalid argument supplied for foreach() in /path_to_code/phpToolkit/soapclient/SforcePartnerClient.php on line 344 QueryResult Object ( [queryLocator] => [done] => 1 [records] => Array ( [0] => SObject Object ( [type] => AggregateResult [fields] => stdClass Object ( ) ) ) [size] => 1 )
not only is there a generated warning, I don't get the query result back...
(2 notes: [1] yes, the Salesforce::connect() method works. [2] running this query in the execute anonymous confirms that the query is valid)
Any ideas?
$active_users_query = "Select COUNT(Id) active_users From User Where isActive=true AND UserType = 'Standard'";
$a = $conn->query($active_users_query);
$queryResult = new QueryResult($a);
for ($queryResult->rewind(); $queryResult->pointer < $queryResult->size; $queryResult->next()) {
$record = $queryResult->current();
echo $record->active_users;
}