Look Up Records step
Summarize
Summary of Look Up Records step
The Look Up Records step in Workflow Studio enables ServiceNow users to query multiple records from any table based on specified conditions. It is designed to help automate workflows by retrieving relevant records efficiently and allows customization through dynamic inputs and error handling options.
Show less
Key Features
- Role and Availability: Available as an action step in Workflow Studio. Users with the
actiondesignerrole can create custom actions incorporating this step. - Inputs:
- Table: Specify the table name containing the records to look up.
- Conditions: Define field names and values to filter records. Inline scripts using
GlideRecordorGlideQueryConditioncan also be used for advanced queries. - Order By: Select a field to sort results.
- Sort Type: Choose ascending or descending order.
- Max Results: Limit the number of records returned to optimize performance.
- Action Error Evaluation: Decide whether to continue or trigger error evaluation if the step fails.
- Outputs:
- Records: List of record Sys IDs matching the lookup criteria.
- Table: The table name containing the returned records.
- Count: Number of records returned.
Practical Guidelines for ServiceNow Customers
- Process Multiple Records: Use the For Each flow logic to iterate through the list of records returned by this step for further processing within your workflows.
- Optimize Performance: Set the Max Results input to 1000 or fewer to reduce system resource usage and improve efficiency.
- Filter Precisely: Apply specific conditions to limit the number of records returned, enhancing both performance and accuracy.
These features allow you to efficiently retrieve and work with multiple records in your workflows, enabling more dynamic and responsive automation scenarios within the ServiceNow platform.
Look up multiple records on any table using defined conditions.
Roles and availability
Available as an Workflow Studio action step. Users with the action_designer role can create a custom action with one or more action steps.
Inputs
Provide a value for each input that your action needs. To add dynamic values, you can also drag pills from the Data panel or select them from the pill picker.
- Table
- Data type: Table Name
Table name containing the records you want to look up.
- Conditions
- Data type: Conditions
Field names and field values that you want to use to search for records. To use an inline script to specify conditions, consider using the GlideRecord and GlideQueryCondition classes to build your query. See GlideRecord - Global and GlideQueryCondition - Global.
- Order by
- Data type: Field Name
Field you want to use to sort results.
- Sort Type
- Data type: Choice
Option to sort alphabetically in ascending or descending order.
- Max Results
- Data type: Integer
The maximum number of record results the step can return.
Action error evaluation
- If this step fails
- Data type: Choice
Option to continue running the next step or go to error evaluation. To use the step status code or message for a custom action error condition, see Action error evaluation.
Outputs
These outputs appear in the Data panel. You can use them as inputs elsewhere in your flow.
- Records
- Data type: Records
List of record Sys IDs found based on the lookup criteria that you provided. For more information, see Records.[Table] data type.
- Table
- Data type: Table Name
Table that contains the list of records.
- Count
- Data type: Integer
Number of records that the step returned.
General guidelines
Use these general guidelines when working with the Look Up Records action.
- Process records with For Each flow logic
- Use For Each flow logic to iterate through a list of records. For more information about using For Each flow logic, see For Each flow logic. Alternatively, you can use a Script step to process a list of records within a custom action.
- Set Max Results to improve performance
- Set the Max Results input to 1000 records or lower to improve the performance of your action. The more records that the system has to look up, the more system resources it takes to identify and process them.
- Use conditions to filter records
- Use conditions to limit the number of records the step returns. The more specific conditions that you can provide, the better performance your action has.