File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ sidebar_position: 6
66
77Use [ SOQL.FilterGroup] ( ../api/soql-filters-group.md ) and Use [ SOQL.Filter] ( ../api/soql-filter.md ) to build your ` WHERE ` clause.
88
9+ Define basic filters in your Selector class.
10+
911``` sql
1012SELECT Id, Name
1113FROM Account
@@ -21,10 +23,37 @@ public inherited sharing class SOQL_Account extends SOQL implements SOQL.Selecto
2123 super(Account.SObjectType);
2224 with(Account.Id, Account.Name);
2325 }
26+
27+ public SOQL_Account byRecordType(String rt) {
28+ whereAre(Filter.recordType().equal(rt));
29+ return this;
30+ }
31+
32+ public SOQL_Account byIndustry(String industry) {
33+ with(Account.Industry)
34+ .whereAre(Filter.with(Account.Industry).equal(industry));
35+ return this;
36+ }
37+
38+ public SOQL_Account byParentId(Id parentId) {
39+ with(Account.ParentId)
40+ .whereAre(Filter.with(Account.ParentId).equal(parentId));
41+ return this;
42+ }
2443}
2544
2645public with sharing class MyController {
2746
47+ @AuraEnabled
48+ public static List<Account> getAccountsByRecordType(String recordType) {
49+ return SOQL_Account.query()
50+ .byRecordType(recordType)
51+ .byIndustry('IT')
52+ .with(Account.Industry, Account.AccountSource)
53+ .toList();
54+ }
55+
56+ @AuraEnabled
2857 public static List<Account> getByIdOrName(Id accountId, String accountName) {
2958 return SOQL_Account.query()
3059 .whereAre(SOQL.FilterGroup
You can’t perform that action at this time.
0 commit comments