Add the Coveo Search Box to a Service Portal Header

This article describes how to add the standalone Coveo search box to a header in your Service Portal.

Since a header is not a Service Portal page, you can’t use the ServiceNow Service Portal Designer to add and configure the Coveo Searchbox widget as specified in Replace the Service Portal Search Boxes. Instead, you must embed the Coveo Searchbox widget in your header record and define the widget options using the record’s HTML template, server script, or client script, depending on your needs.

These instructions detail how to add the Coveo Searchbox widget to a header using only the HTML template. However, you can use these instructions as a guide to add the Coveo search box to any block element in your Service Portal using the record’s HTML template, server script, or client script.

To embed the Coveo Searchbox widget in a header

  1. In the Now Platform UI of your ServiceNow instance, navigate to Service Portal > Headers & Footers, and then click the desired header.

  2. In your header record Body HTML template field, copy and paste the following code to embed the Coveo Searchbox widget in the header.

    <widget id="coveo-searchbox"></widget>
  3. Define the desired Searchbox widget options.

    EXAMPLE

    To define the search_page_id option in the Body HTML template field, enter:

    <widget id="coveo-searchbox" options='{"search_page_id": "[MY_SEARCH_PAGE_ID]"}'></widget>

    Where [MY_SEARCH_PAGE_ID] is the ID of the ServiceNow page in which you embedded the Main Search widget.

    For example, if the ID of the page is sp_search, enter:

    <widget id="coveo-searchbox" options='{"search_page_id": "sp_search"}'></widget>
Recommended Articles