简体   繁体   English

如何通过Salesforce中的SOQL访问查找字段?

[英]How to access a lookup field through SOQL in salesforce?

3 Standard Objects: A, B, C 3个标准物体:A,B,C

  1. A has a field f1 lookup with B object. A有一个B对象的字段f1查找。
  2. B has a field f2 lookup with C object. B对C对象进行了字段f2查找。
  3. C has a field f3 which is a text. C具有作为文本的字段f3。

How to access f3 field value through Object A? 如何通过对象A访问f3字段值?

Assuming A, B and C are standard objects, and f1, f2, f3 are standard fields; 假设A,B和C是标准对象,而f1,f2,f3是标准字段; and all of them are API names, your SOQL query would look something like: 并且所有这些都是API名称,您的SOQL查询将类似于:

SELECT f1.f2.f3 FROM A

If A, B and C are custom objects, and f1, f2 and f3 are custom fields; 如果A,B和C是自定义对象,而f1,f2和f3是自定义字段; and again all of them are API names, it would look like: 而且它们都是API名称,看起来像:

SELECT f1__r.f2__r.f3__c FROM A__c

Also remember to add some kind of WHERE or LIMIT clause to avoid hitting governor limits . 还要记住要添加某种WHERELIMIT子句,以免达到调节器限制

More info on SOQL relationships. 有关SOQL关系的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM