Help Centre › Functions & Formulas
This article describes the RPA Salesforce connector function to execute a SOQL query.
For a full list of available functions, please read SALESFORCE functions.
Description
The SOQL query function executes a Salesforce Object Query Language (SOQL) query and returns the results with auto-pagination. Use this to retrieve records from any Salesforce object with filtering, sorting, and field selection.
Setting it up
{{popups:rpas/add:action=salesforce-query}}
Once on a process map:
- Navigate to the process where you would like to add the function
- Click on the green button’s drop-down (right side of the green button labelled “Process”)
- On the menu that appears, click on the “+ Activity” item
- From here you can select the SALESFORCE SOQL query option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Connector | Yes | Select | - | Select the Salesforce connector to use |
| SOQL | Yes | Textarea | - | SOQL query string (e.g. SELECT Id, Name FROM Account WHERE Industry = 'Technology') |
| Variable | Yes | Text | - | Variable to store the query results |
Output variables
| Variable | Type | Description |
|---|---|---|
| Variable | Array | Array of records matching the query, auto-paginated |
Errors
- MALFORMED_QUERY – the SOQL syntax is invalid
- INVALID_FIELD – a field name in the query does not exist on the sObject
- Authentication failed – the connector token has expired
Tips
- Use variables in the query: SELECT Id FROM Contact WHERE Email = '{email}'
- Results are auto-paginated – all matching records are returned
- Use LIMIT and OFFSET for manual pagination if needed
- Access fields via {variable.0.Name}, {variable.0.Id}, etc.
Related functions
- SOSL search – Full-text search across multiple objects
- Get record – Get a single record by ID
- Describe sObject – Get field metadata for a query