The CatalogSearch API enables you to search catalog item.

To use this class in a scoped application, use the sn_sc namespace identifier. The Service Catalog Scoped API plugin (ID: com.glideapp.servicecatalog.scoped.api) that is enabled by default is required to access the CatalogSearch API.

Scoped CatalogSearch - CatalogSearch()

Creates an instance of the CatalogSearch class.

Table 1. Parameters
Name Type Description
None

Example

var catSearchGR = new sn_sc.CatalogSearch().search('', '', 'Apple', false, true);
catSearchGR.query();
while(catSearchGR.next()) {
  gs.info(catSearchGR.getValue('name'));
}

Scoped CatalogSearch - search (String catalogID, String categoryID, String term, Boolean mobile, Boolean noDepthSearch)

Searches a catalog item based on a search term. The search can be narrowed down to a catalog category level.

Table 3. Returns
Type Description
GlideRecord Returns the GlideRecord on sc_cat_item matching the search result.

Example

This example shows how to search all catalogs and all categories for term: ServiceNow.

var now_GR = new sn_sc.CatalogSearch().search('', '', 'ServiceNow', false, false);
now_GR.query();
while(now_GR.next()) {
  gs.log(now_GR.name);
}

Output

ServiceNow T-shirt