[英]SOQL: Accessing the Contact Owner Field
I'm trying to write a SOQL query that will grab one of the Contact object's standard fields "Contact Owner", which is a Lookup(User) field: 我正在尝试编写一个SOQL查询,它将获取Contact对象的标准字段“Contact Owner”之一,这是一个查找(用户)字段:
The field name is "Owner", but when I try to query 字段名称是“所有者”,但是当我尝试查询时
SELECT Contact.Owner FROM Contact SELECT Contact.Owner FROM Contact
I get an error stating that there is no such field. 我收到一条错误,指出没有这样的字段。
SELECT Contact.Owner, Contact.Name, Contact.Rule_Class__c
^
ERROR at Row:1:Column:8
No such column 'Owner' on entity 'Contact'. 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.
How can I grab this field? 我怎么能抓住这个领域?
Thank you! 谢谢!
That's a normal behavior for Relation fields 这是Relation字段的正常行为
You can imagine OwnerId
as an alias 您可以将
OwnerId
想象为别名
SELECT LastModifiedBy.Name, LastModifiedBy.Id, LastModifiedById FROM Contact
SELECT CreatedBy.Name, CreatedBy.Id, CreatedById FROM Contact
Also use Workbench or Developer console or Eclipse to construct your queries instead of using salesforce setup interface 还可以使用Workbench或Developer控制台或Eclipse构建查询,而不是使用salesforce设置界面
Workbench 工作台
Developer Console Developer Console
This is strange: 这很奇怪:
"Select c.Owner.Email, c.Owner.Name, c.Owner.Username, c.OwnerId From Contact c Run the above in Developer Console--Query Editor"
“选择c.Owner.Email,c.Owner.Name,c.Owner.Username,c.OwnerId来自联系人c在开发者控制台中执行以上操作 - 查询编辑器”
https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_DETAIL&dc=General_Development&criteria=OPENQUESTIONS&id=906F0000000AvMHIA0 https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_DETAIL&dc=General_Development&criteria=OPENQUESTIONS&id=906F0000000AvMHIA0
I wonder why Contact.Owner comes up as non-existent but Contact.Owner.Name is? 我想知道为什么Contact.Owner出现不存在但Contact.Owner.Name是?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.