Salesforce不允许从关系中查找国家/地区,但允许使用名称和ID

时间:2014-08-29 07:30:53

标签: salesforce

我在salesforce中运行以下查询以获取国家/地区

SELECt name, owner.country from lead

这会出现以下错误:

No such column 'country' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

然而,如果我这样做,那就可以了。

SELECt name, owner.id from lead
SELECt name, owner.username from lead
SELECt name, owner.name from lead

它提供数据

1 个答案:

答案 0 :(得分:0)

这是由于多态关系而发生的。如果您仔细阅读了所获得的错误,您可能已经注意到该实体是Name,它不是User(正如我之前预期的那样)。 The Name对象用于从相关记录中检索信息,其中相关记录可能来自多个对象类型。

  

例如,案例的所有者可以是用户或组   (队列)

WhoWhatOwner关系字段将用于访问此Name对象,并且无法直接访问该对象。您收到的错误是由于此Name实体没有名为country的字段,您可以在文档中看到。