Look Up Record step
Summarize
Summary of Look Up Record step
The Look Up Record step in Workflow Studio enables ServiceNow customers to retrieve a record from any table by specifying conditions. It is designed for users with theactiondesignerrole who create custom actions with one or more action steps. This step is useful for automating workflows that require fetching specific records based on static or dynamic criteria.
Show less
Key Features
- Table Selection: Choose the table from which to look up the record.
- Conditions: Define filters to find the record. Conditions can be static (fixed for every run) or dynamic (using input data pills for flexibility in flows). When referencing fields, use the Sys ID format for accuracy, especially with reference fields.
- Ordering: Specify how to sort results if multiple records match. You can sort by any field in ascending or descending alphabetical order.
- Handling Multiple Matches: Decide whether to return only the first matching record or fail the step if multiple records are found.
- Error Handling: Configure whether the flow should fail if no record is found or continue running subsequent steps.
- Outputs: The step provides several outputs usable in later workflow stages:
- Record: The found record matching the conditions.
- Table: The name of the table from which the record was retrieved.
- Status: Indicates success (1) or failure (0) of the lookup.
- Error Message: Details about why a record could not be found, populated only if status is 0.
- Action Error Evaluation: Provides options to continue or evaluate errors if this step fails, allowing tailored error handling in custom actions.
Practical Application
This step allows workflow designers to integrate precise data retrieval into their automation processes, ensuring that subsequent steps have the required context and data. By supporting both static and dynamic conditions, it offers flexibility for various use cases, from simple record fetches to complex, condition-driven workflows.
Understanding how to use Sys ID references in conditions is critical for accurate lookups, particularly when dealing with reference fields between tables like Change and Incident.
Look up a record from any table based on 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.
Fields
| Field | Description |
|---|---|
| Table | Select a table from the list. |
| Conditions | Set static or dynamic conditions to filter records. To define a static condition applied each time the action runs, define the conditions with the condition builder. To enable flow designers to dynamically apply conditions, define an input of type Conditions and drag-and-drop the input data pill into the Conditions field. When building a condition that looks up the value of a reference field, use a data pill that explicitly provides the Sys ID value. Ensure the condition has the format [reference field][is][Reference type data pill->Sys ID]. For example, both the Change and Incident tables contain a reference field to the User table. To look up change records where the requester is the caller from an incident record, create the condition [Requested by][is][Trigger->incident record->Caller->Sys ID]. [Requested by][is][action->incident->Caller->Sys ID] where incident is an input variable for an incident record. |
| Order by | Determines how to sort results when more than one record matches the defined conditions. Select the field you want to use to sort results. |
| Sort Type | Select whether to sort alphabetically in ascending or descending order. |
| If multiple records are found | Determines what is returned if more than one record matches
the defined conditions.
|
| Don't fail on error | Determines whether to fail the flow if a record can't be found. |
Outputs
These outputs appear in the Data panel. You can use them as inputs elsewhere in your flow.
- Record
- Data type:
Record
Record found based on the conditions you specified in the Conditions input.
- Table
- Data type:
Table
Name of the table associated with the returned record.
- Status
- Data type:
Choice
1 if a record was found successfully, and 0 if there was an error.
- Error Message
- Data type:
String
Message containing details about why the record could not be found.
Note:This output's value is only populated if the Status output's value is 0.
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.