Help Centre › Functions & Formulas
This article describes the RPA ServiceNow connector function to query records from a table.
For a full list of available functions, please read SERVICENOW functions.
Description
The Query records function retrieves records from a ServiceNow table using encoded query strings. Supports field selection, display value control, and auto-pagination. Common tables include incident, sys_user, change_request, and problem.
Setting it up
{{popups:rpas/add:action=servicenow-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 SERVICENOW Query records option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Connector | Yes | Select | - | Select the ServiceNow connector to use |
| Table | Yes | Text | - | Table name (e.g. incident, sys_user, change_request) |
| Query | No | Text | - | Encoded query string (e.g. active=true^priority=1) |
| Fields | No | Text | - | Comma-separated fields to return |
| Display value | No | Select | false | Return display values: true, false, or all |
| Variable | Yes | Text | - | Variable to store the results |
Output variables
| Variable | Type | Description |
|---|---|---|
| Variable | Array | Array of records matching the query |
Errors
- Table not found – the table name is invalid
- Authentication failed – credentials are incorrect
- Insufficient rights – user lacks read access to the table
Tips
- Use encoded query syntax: active=true^priority=1^category=hardware
- Use ^ for AND, ^OR for OR conditions
- Set display value to 'all' to get both sys_id references and display text
- Limit returned fields for better performance
Related functions
- Get record – Get a single record by sys_id
- Aggregate query – Get counts and sums
- Create record – Create a new record