@@ -12,7 +12,7 @@ weight: 4
12
12
13
13
## byId
14
14
15
- Add a condition to the query, limiting the sObject to a specific ID or a
15
+ Add a condition to the query, filtering the result by a specific ID or a
16
16
collection of ID. Alias to ` addConditionEq('Id', ...) `
17
17
18
18
#### public Query byId(Id id)
@@ -55,6 +55,84 @@ Query query =
55
55
56
56
<article id =" 2 " >
57
57
58
+ ## lookup
59
+
60
+ Add a condition to the query, filtering the result by a foreign key.
61
+
62
+ #### public Query lookup(String fieldName, Id id)
63
+
64
+ fieldName: The lookup field name
65
+
66
+ id: The Id to filter the lookup field
67
+
68
+ ``` javascript
69
+
70
+ Query query =
71
+ new Query (' Contact' ).
72
+ lookup (' AccountId' , ' 001O000000qkv3KIAQ' );
73
+
74
+ ```
75
+
76
+ #### public Query lookup(String fieldName, List\< Id\> idList)
77
+
78
+ fieldName: The lookup field name
79
+
80
+ idList: The list of Id to filter the lookup field
81
+
82
+ ``` javascript
83
+
84
+ Query query =
85
+ new Query (' Contact' ).
86
+ lookup (' AccountId' , new List < Id> {' 001O000000qkv3KIAQ' });
87
+
88
+ ```
89
+
90
+ #### public Query lookup(String fieldName, Set\< Id\> idSet)
91
+
92
+ fieldName: The lookup field name
93
+
94
+ idSet: The Set of Id to filter the lookup field
95
+
96
+ ``` javascript
97
+
98
+ Query query =
99
+ new Query (' Contact' ).
100
+ lookup (' AccountId' , new Set < Id> {' 001O000000qkv3KIAQ' });
101
+
102
+ ```
103
+
104
+ #### public Query lookup(String fieldName, SObject sobj)
105
+
106
+ fieldName: The lookup field name
107
+
108
+ sobj: The SObject record, whose Id will be taken to filter the lookup field
109
+
110
+ ``` javascript
111
+
112
+ Query query =
113
+ new Query (' Contact' ).
114
+ lookup (' AccountId' , new Account (Id = ' 001O000000qkv3KIAQ' ));
115
+
116
+ ```
117
+
118
+ #### public Query lookup(String fieldName, List\< SObject\> sObjectList)
119
+
120
+ fieldName: The lookup field name
121
+
122
+ sObjectList: The list of SObject records, whose Id will be taken to filter the lookup field
123
+
124
+ ``` javascript
125
+
126
+ Query query =
127
+ new Query (' Contact' ).
128
+ lookup (' AccountId' , new List < Account> {new Account (Id = ' 001O000000qkv3KIAQ' )});
129
+
130
+ ```
131
+
132
+ </article >
133
+
134
+ <article id =" 3 " >
135
+
58
136
## addConditionXX
59
137
60
138
Add a condition to the query, limiting the sObject. 'XX' can be one of these
@@ -245,7 +323,7 @@ Query query =
245
323
246
324
</article >
247
325
248
- <article id =" 3 " >
326
+ <article id =" 4 " >
249
327
250
328
## addCondition
251
329
@@ -266,7 +344,7 @@ Query q =
266
344
267
345
</article >
268
346
269
- <article id =" 4 " >
347
+ <article id =" 5 " >
270
348
271
349
## conditionXX
272
350
@@ -481,7 +559,7 @@ Query q =
481
559
482
560
</article >
483
561
484
- <article id =" 5 " >
562
+ <article id =" 6 " >
485
563
486
564
## doAnd
487
565
@@ -589,7 +667,7 @@ Query q =
589
667
590
668
</article >
591
669
592
- <article id =" 6 " >
670
+ <article id =" 7 " >
593
671
594
672
## doOr
595
673
@@ -699,7 +777,7 @@ Query q =
699
777
700
778
</article >
701
779
702
- <article id =" 7 " >
780
+ <article id =" 8 " >
703
781
704
782
## Misc
705
783
0 commit comments