I'm relatively new to Salesforce and the Salesforce API and came across something that seemed odd, your help would be appreciated.
I'm using the following query with the PHP API:
$query="Select FirstName, LastName, Email, (select Campaign.Name, CampaignId from CampaignMembers) From Lead where Email ='testsflead@example.com'";
$response = $mySforceConnection->query($query);
$queryResult = new QueryResult($response);
for ($queryResult->rewind(); $queryResult->pointer < $queryResult->size; $queryResult->next()) {
$record = $queryResult->current();
foreach($record->queryResult[0]->records as $campaignResults) {
var_dump($campaignResults);
}
}
When I tried to run comparison operators on some of the results they failed. var_dump revealed that the character count for some of the results were not as they appeared.
Look at the any['Campaign']->any
and any[0]
strings, see how the character count is 19 characters more for any['Campaign']->any
and 31 characters more for any[0]
.
Here is the output of var_dump:
object(stdClass)#11 (3) {
["type"]=>
string(14) "CampaignMember"
["Id"]=>
NULL
["any"]=>
array(2) {
["Campaign"]=>
object(stdClass)#12 (3) {
["type"]=>
string(8) "Campaign"
["Id"]=>
NULL
["any"]=>
string(29) "Campaign 1"
}
[0]=>
string(49) "701F0000000m06gIAA"
}
}
object(stdClass)#13 (3) {
["type"]=>
string(14) "CampaignMember"
["Id"]=>
NULL
["any"]=>
array(2) {
["Campaign"]=>
object(stdClass)#14 (3) {
["type"]=>
string(8) "Campaign"
["Id"]=>
NULL
["any"]=>
string(29) "Campaign 2"
}
[0]=>
string(49) "701F0000000m06jIAA"
}
}
object(stdClass)#15 (3) {
["type"]=>
string(14) "CampaignMember"
["Id"]=>
NULL
["any"]=>
array(2) {
["Campaign"]=>
object(stdClass)#16 (3) {
["type"]=>
string(8) "Campaign"
["Id"]=>
NULL
["any"]=>
string(29) "Campaign 2"
}
[0]=>
string(49) "701F0000000m06kIAA"
}
}