Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.
  • Madrid
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store

Define a search source

Log in to subscribe to topics and get notified when content changes.

Define a search source

A search source is a record that describes the behavior and source of searchable data. Configure a basic search source to query data from an instance table, or configure an advanced data fetch script to pull data from anywhere on the web.

About this task

A search source defines:
  • Where search data is retrieved from.
  • Whether search suggestions can populate the search field based on user input.
  • How a search entry displays in the search result page.

Search sources have simple and advanced configurations.

Define a table within your ServiceNow instance as a source of searchable data.
Define a data fetch script to return data. A data fetch script executes on the server and returns a result array to the search widget. This method is more complex, but offers complete power over how a search is executed. You are not limited to records and tables within ServiceNow and can define a script that fetches data from anywhere on the web. To learn more, review the Tutorial: set up an external knowledge base search source.

Typeahead returns search results in real time as a user types in the search field. You can configure typeahead settings, or disable the feature entirely, within the search source record. Typeahead return search has simple and advanced configurations.

Define an icon to display beside typeahead results and the target page to display typeahead selections.
Define a template for the typeahead result. See Create an advanced typeahead template.


  1. In the platform UI, navigate to Service Portal > Portals and select the portal you want to add search sources to.
  2. From the Search Sources related list, click New to add a search source.
  3. Define the fields on the Search Source form.
    Table 1. Search Source form
    Field Description
    Name The display value for the search category.
    ID The record ID. The value should be unique, and should not include any spaces or special characters.
    Application The scope of the search source.
    Roles If the Service Portal User Criteria Support plugin is not enabled, define user roles to access this search source.
    Search page template

    The HTML template that displays the search results. If defining a basic search source, you do not need to change the default template.

    For an example of a modified template, see Tutorial: set up an external knowledge base search source.

  4. Complete the fields on the Data Source tab.
    Field Description
    Is scripted source Select this option to add an advanced data fetch script. If configuring an instance table as the data source, do not check this option.
    Data fetch script

    A script defining the endpoint and API calls to fetch external data. This field is only visible when Is scripted source is selected.

    For an example of a data fetch script, see Tutorial: set up an external knowledge base search source.

    Table Select a table from the list that you want to draw your results from. You can select any table in the platform. For example, User [sys_user] or Knowledge [kb_knowledge].
    Note: Only indexed tables return search results. Learn more: Enable text indexing for a table .
    Conditions Apply a filter to the table if you don't want all the search results to display. For example, Active is True.
    Primary display field Select which field you want to display on the search results page. For example, Name.
    Display fields Select additional fields to display on the search results page. For example, User ID, Email, and City.
    New search source page with Questions and Answers selected as the search source
  5. Configure Typeahead settings to allow search results to populate the search field based on user input.
    Field Description
    Enable typeahead Allows typeahead functionality. If you do not want to integrate typeahead into your search source, clear the check box.
    Advanced typeahead config Optionally add an advanced typeahead script to configure the way search results display. For more information, see Create an advanced typeahead template.
    Typeahead glyph Adds an icon beside each typeahead result.
    Page Defines a service portal page to display the selected result. For example, if form is configured, a selected typeahead result opens in a form.

  6. Click Submit.
  7. Configure the way typeahead results display with an advanced template.
    1. In the Typeahead tab of the Search Source record, select the Advanced typeahead config check box.
    2. In the Typeahead template field, add an HTML template.

      This example uses AngularJS bindings to display service catalog images in the typeahead results.

      <i class="ta-img" ng-if="match.model.type=='sc'" style="background-image:url('{{match.model.picture}}')"></i> 
      <i class="ta-img" ng-if="match.model.type=='sc_guide'" style="background-image:url('{{match.model.picture}}')"></i> 
      <i class="ta-icon fa fa-file-text-o" ng-if="match.model.type=='sc_content' && match.model.content_type == 'kb'"></i> 
      <strong ng-if="match.model.type=='sc_content' && match.model.content_type == 'external'">➚</strong> 
      <span ng-bind-html="match.label | uibTypeaheadHighlight:query"></span>
    3. Click Update.

      Typeahead results display beside the image defined in the service catalog record.