You need to sign in to do that
Don't have an account?
sideburn
query for account id
Hi, I have the following code to get the owner id from an account:
$query_str = "select 'OwnerId' from 'account' where Name = 'The Company Name'";
$result = $client->query($query_str,1)
while (list($k1, $record) = each($result->records)) {
printf(":: %s",$record);
}
this is the output result:
:: Account
::
:: 00530000000QJjmAAG
It works but all I want is the account ID itself not the other 2 strings. Can someone explain why this is happenening? (I'm just trying to get an account ID from an account Name)...Thanks.
$query_str = "select 'OwnerId' from 'account' where Name = 'The Company Name'";
$result = $client->query($query_str,1)
while (list($k1, $record) = each($result->records)) {
printf(":: %s",$record);
}
this is the output result:
:: Account
::
:: 00530000000QJjmAAG
It works but all I want is the account ID itself not the other 2 strings. Can someone explain why this is happenening? (I'm just trying to get an account ID from an account Name)...Thanks.
Message Edited by sideburn on 02-23-2006 01:31 AM
Try printf(":: %s", $record->Id);
I get:
:: type
:: Id
:: OwnerId
object(stdClass)(4) { ["done"]=> string(4) "true" ["queryLocator"]=> string(0) "" ["records"]=> &object(stdClass)(3) { ["type"]=> string(7) "Account" ["Id"]=> string(0) "" ["OwnerId"]=> string(18) "00530000000p0A8AAI" } ["size"]=> string(1) "1" }
$query = "SELECT Id,Name,BillingCity,BillingState,Phone,Fax from Account";
$queryOptions = new QueryOptions(500);
$response = $mySforceConnection->query(($query), $queryOptions);
if ($response->size > 0) {
if ($response->size == 1) {
$recs = array ($response->records
);
} else {
$recs = $response->records;
}
}
foreach ($recs as $r) {
echo $r->Id;
}
Array
Try the following:
This works with the native SOAP API in PHP5, possibly not with other packages, but you'll get the idea.
Message Edited by Redsummit on 02-24-2006 10:34 AM