Look Up Records step

  • Release version: Washingtondc
  • Updated August 1, 2024
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Look Up Records step

    The Look Up Records step in ServiceNow's Flow Designer allows users to retrieve multiple records from any table based on defined conditions. This action is available to users with theactiondesignerrole, enabling the creation of custom actions with one or more steps.

    Show full answer Show less

    Key Features

    • Inputs: Users must provide values for:
      • Table: Name of the table containing records to look up.
      • Conditions: Specify field names and values for record search. Inline scripts can utilize GlideRecord and GlideQueryCondition.
      • Order by: Field used to sort results.
      • Sort Type: Choose ascending or descending order.
      • Max Results: Set a limit on the number of returned records (recommended to be 1000 or lower for performance).
      • Action error evaluation: Choose whether to continue to the next step or evaluate errors if this step fails.
    • Outputs: The outputs available in the Data panel include:
      • Records: List of record Sys IDs found.
      • Table: Name of the table containing the returned records.
      • Count: Total number of records returned.
    • General Guidelines:
      • Use For Each flow logic to process records iteratively.
      • Set Max Results to enhance performance by limiting the number of records processed.
      • Utilize specific conditions to filter records effectively, improving action performance.

    Key Outcomes

    By effectively using the Look Up Records step, ServiceNow customers can streamline their workflows, enhance performance, and ensure efficient data retrieval based on precise criteria. This capability supports better decision-making and operational efficiency within their processes.

    Look up multiple records on any table using defined conditions.

    Roles and availability

    Available as an Action Designer 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.

    Example

    Example Look Up Records step in an action.