这是一个代表我的问题的通用查询示例。
$query = "SELECT Account.Name, Name from Contract WHERE AccountId = '001U0000003q6scIAA'";
$response = $mySforceConnection->query($query);
foreach ($response->records as $record) {
$sObject = new SObject($response->records[0]);
var_dump($sObject);
echo $sObject->sobjects[0]->Name."<br/>\n";
echo $record->fields->Name."<br/>\n";
echo "*******************************<br/>\n";
echo "*******************************<br/>\n";
}
问题是 Account.Name 字段不会显示。以防万一我的整个方法是错误的,我们的想法是获取分配给特定帐户的所有合同,并显示帐户名称和合同中的相关信息。(到目前为止,所有合约字段都显示完美。只是无法显示帐户名称)
提前感谢您的帮助!
这是 var_export() ..(我删除了所有自定义字段)
SObject::__set_state(array( 'type' => 'Contract', 'fields' => stdClass::__set_state(array(
'AccountId' => '001U0000003q6scIAA', 'Name' => 'test contract', '1' =>
SObject::__set_state(array( 'type' => 'Account', 'fields' => stdClass::__set_state(array(
'Name' => 'test Account name', )), )), )), ))
这是 var_dump() ...
object(SObject)#5 (2) { ["type"]=> string(8) "Contract" ["fields"]=> object(stdClass)#1871 (14) {
["AccountId"]=> string(18) "001U0000003q6scIAA" ["Name"]=> string(18) "Test Contract Name"
["1"]=> object(SObject)#1869 (2) { ["type"]=> string(7) "Account" ["fields"]=> object(stdClass)#1870 (1) { ["Name"]=> string(15) "Account Name" } } } }