Using Natural Language Query

  • Release version: Yokohama
  • Updated January 30, 2025
  • 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 Using Natural Language Query

    Natural Language Query (NLQ) enables you to query data in ServiceNow tables using plain, everyday language instead of manually building query conditions. NLQ automatically translates your natural language requests into structured queries, making it easier to find and filter data without needing deep knowledge of the condition builder. It works on any list in the platform and returns results specific to the table or list you query.

    Show full answer Show less

    Using NLQ

    To use NLQ, select the natural language filter icon on a list. Enter your request in the “What do you want to see” field and select Ask. NLQ will parse your request, display the corresponding query in the condition builder, and show matching results in the list.

    You can refine queries incrementally by entering additional natural language statements, which NLQ adds as new conditions. For example, you can start with “show me active hardware tickets” and then narrow results by adding “without assignment group.” To reset, clear the condition builder to start a new query from scratch.

    Key Usage Details

    • NLQ supports periods and apostrophes in requests but does not allow wildcard characters like asterisks or regex.
    • To group results by a column, ensure that column is visible in the list view using the personalize list icon.
    • NLQ is available to users with roles such as itil that permit viewing and interacting with tables.
    • For querying configuration management database (CMDB) tables, specific guidance is available separately.

    Tips for Improving Queries

    NLQ provides guidance on useful terms for constructing queries, including:

    • Sorting and grouping: Use phrases like “grouped by,” “sorted by,” “A-Z,” or “z-a.”
    • Date filters: Specify relative dates such as “today,” “yesterday,” “last month,” “next week,” etc.
    • Filtering operators: Use “starts with,” “ends with,” “more than,” “less than,” “empty,” “not empty,” “and,” “or.”
    • Other keywords: Include “my,” “my team,” “created by,” and “unassigned” for personalized queries.

    Examples include queries like “incidents grouped by category,” “created last month,” or “short description starts with computer.”

    Benefits for ServiceNow Customers

    • Quickly search and filter data without mastering complex query builders.
    • Incrementally refine queries using natural language, improving productivity and accuracy.
    • Visual confirmation of query conditions helps verify and adjust filters easily.
    • Works seamlessly across any list, enhancing user experience throughout the platform.

    With Natural Language Query (NLQ), you can query data in your tables by entering requests in natural, everyday language.

    NLQ overview

    NLQ turns your plain-language requests into structured queries of your data. You don't need to know how to use the condition builder, because NLQ constructs and displays the conditions for you.

    If you have a role such as itil that can view and interact with tables, you can use NLQ by selecting the natural language filter icon.

    NLQ works on any list on the platform. It returns results only from the table or list you query on.

    Find and use the natural language filter

    Selecting the natural language filter icon brings up the NLQ interface.

    NLQ interface in list view.

    Enter your request in the What do you want to see field, then select Ask. NLQ parses your request, then displays the query in the condition builder. The results of the query are displayed in the list.

    With the default configuration of NLQ, you can continue to refine your query by entering another request into the What do you want to see field.
    Figure 1. Using NLQ to build on a previous query
    Using NLQ to append a query to a previous query

    This example image and procedure illustrates how to build a query using NLQ:

    1. On the Incident table in the natural language filter, enter show me active hardware tickets and select the Ask button.
    2. The condition builder displays All > Active = true > Category = Hardware as the query. The filtered results are displayed in the list.
    3. To narrow down the list of results further, enter without assignment group. Notice that as you type, NLQ displays possible matches for columns and fields. Select assignment group from the list of suggestions, and then Ask.
    4. In the condition builder, NLQ adds >Assignment group is empty to the query. The list refreshes to display only the matching rows.
    5. To reset and start a new query, delete everything in the condition builder so that only All remains.

    Useful information

    Keep the following information in mind when using NLQ.
    • Your requests can contain periods and apostrophes, but not wildcard characters such as asterisks or regex.
    • To group by a field or column, that column must be visible in the list view. Use the personalize list icon (Personalize list icon.) to hide or display columns.
    • For information about querying CMDB tables, see Querying the CMDB.

    Tips for improving your queries

    When you select the Tips for improving your queries button, a modal window appears in the user interface. This window offers the following information about terms you can use in your NLQ questions and requests:
    • Sorting or grouping: grouped by; sorted by; A-Z; z-a
    • Dates: today; yesterday; last; this; next day(s); week(s); quarter(s); year(s)
    • Filtering: starts with; ends with; more than; less than; empty; not empty; and; or
    • Other information: my; my team; created by; unassigned
    Query Example
    Sorting or grouping incidents grouped by category
    Dates created last month
    Filtering short description starts with computer
    Other information unassigned tickets
    Single number INC0777