Search object that allows the ability to query objects from Salesforce. This request object allows a variety of search options to dynamically create SOQL statements.
Method Summary
Modifier and Type | Method and Description |
---|---|
SearchRequest | getInstance() |
SearchRequest | getInstance(String version) |
SearchRequest | fields(String fields) |
SearchRequest | fields(List |
SearchRequest | field(SObjectField field) |
SearchRequest | field(String field) |
SearchRequest | fields(List |
SearchRequest | filter(String searchCriteria) |
SearchRequest | selectById(String selectById) |
void | selectById(List |
SearchRequest | selectById(Set |
void | equals(SObjectField field, Object value) |
void | contains(SObjectField field, List |
SearchRequest | filter(String searchCriteria,List |
SearchRequest | orderBy(String orderBy) |
SearchRequest | soqlLimit(Integer soqlLimit) |
SearchRequest | soqlOffset(Integer soqlOffset) |
SearchRequest | entityId(Id entityId) |
SearchRequest | additionalFields(String additionalFields) |
SearchRequest | applyAccessPermissions(Boolean applyAP) |
void | SearchRequest() |
void | executeQuery(SObjectType sObjectType) |
Method Detail
This class supports the following methods:
global static SearchRequest getInstance()
Get instance of the SearchRequest object via inversion of control
global static SearchRequest getInstance(String version)
Get instance of the SearchRequest object via inversion of control
Parameters
Name | Type | Description |
---|---|---|
version | String | undefined |
global virtual SearchRequest fields(String fields)
Comma separated list of fields to return instead of querying entire object
Parameters
Name | Type | Description |
---|---|---|
fields | String | String |
global virtual SearchRequest fields(List<SObjectField> fields)
List of SObjectField's to return instead of querying entire object
Parameters
Name | Type | Description |
---|---|---|
fields | List<SObjectField> | List |
global virtual SearchRequest f(SObjectField field)
SObjectField to query instead of entire object
Parameters
Name | Type | Description |
---|---|---|
field | SObjectField | SObjectField |
global virtual SearchRequest field(SObjectField field)
SObjectField to query instead of entire object
Parameters
Name | Type | Description |
---|---|---|
field | SObjectField | SObjectField |
global virtual SearchRequest field(String field)
String field name to query instead of entire object
Parameters
Name | Type | Description |
---|---|---|
field | String | String |
global virtual SearchRequest fields(List<String> fields)
List of string field names to query instead of entire object
Parameters
Name | Type | Description |
---|---|---|
fields | List<String> | List |
global virtual SearchRequest filter(String searchCriteria)
SOQL where clause that will used to query. The filter criteria can be in the following format Is_Active__c = true
. The request object will automatically escape and format the query.
Parameters
Name | Type | Description |
---|---|---|
searchCriteria | String | String |
global virtual SearchRequest selectById(String selectById)
Select a single record by Id
Parameters
Name | Type | Description |
---|---|---|
selectById | String | String |
global virtual SearchRequest selectById(List<Id> selectByIds)
Parameters
Name | Type | Description |
---|---|---|
selectByIds | List<Id> | undefined |
global virtual SearchRequest selectById(Set<Id> selectByIds)
Select records by a list of Id's
Parameters
Name | Type | Description |
---|---|---|
selectByIds | Set<Id> | Set |
global virtual SearchRequest equals(SObjectField field, Object value)
global virtual SearchRequest contains(SObjectField field, List<Object> values)
Parameters
Name | Type | Description |
---|---|---|
field | SObjectField | undefined |
values | List<Object> | undefined |
global virtual SearchRequest filter(String searchCriteria,List<Object> queryTokens)
SOQL where clause that will used to query. The filter criteria can be in the following format Id = {0} AND Sales_Order__c IN ({1})
. The request object will automatically escape and format the query.
Parameters
Name | Type | Description |
---|---|---|
searchCriteria | String | String |
queryTokens | List<Object> | List |
global virtual SearchRequest orderBy(String orderBy)
SOQL Sort By clause
Parameters
Name | Type | Description |
---|---|---|
orderBy | String | String |
global virtual SearchRequest soqlLimit(Integer soqlLimit)
SOQL Limit clause
Parameters
Name | Type | Description |
---|---|---|
soqlLimit | Integer | Integer |
global virtual SearchRequest soqlOffset(Integer soqlOffset)
SOQL Offset for multi page searches
Parameters
Name | Type | Description |
---|---|---|
soqlOffset | Integer | Integer |
global virtual SearchRequest entityId(Id entityId)
Entity Id of who is executing the query or who the access permissions should be run by
Parameters
Name | Type | Description |
---|---|---|
entityId | Id | Id |
global virtual SearchRequest additionalFields(String additionalFields)
Any additional fields to query such as related record fields. Comma separated CSV of field api names.
Parameters
Name | Type | Description |
---|---|---|
additionalFields | String | String |
global virtual SearchRequest applyAccessPermissions(Boolean applyAP)
Whether or not to apply access permissions in the service classes.
Parameters
Name | Type | Description |
---|---|---|
applyAP | Boolean | Boolean |
global SearchRequest()
SearchRequest Constructor that should not be called directly.
global virtual List<SObject> executeQuery(SObjectType sObjectType)
Parameters
Name | Type | Description |
---|---|---|
sObjectType | SObjectType | undefined |