CatalogSearch - Scoped

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
var gr = new sn_sc.CatalogSearch();

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

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

Table 2. Parameters
Name Type Description
catalogID String Identifier of the catalog that is searched.
categoryID String Identifier of the catalog category that is searched.
term String Search term.
mobile Boolean If true, only catalog items exposed for mobile are searched.
depthSearch Boolean If true, subcategories are also searched.
Table 3. Returns
Type Description
GlideRecord Returns the GlideRecord on sc_cat_item matching the search result.

Example

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

Output

Apple iPhone 6s Plus
Apple iPhone 6s
Apple MacBook Pro 15"
Apple Watch
Apple Watch Series 2
Apple iPhone 5
Apple iPad 3
Apple iPhone 4 Cable
Apple iPhone 5 Cable 
QuickTime Pro
OS X Yosemite
Apple Thunderbolt to Ethernet Adapter
Microsoft Surface Pro 3
OS X Mavericks
Spigen iPhone 6 Case
MacBook Pro Power Adapter
MacBook Air Power Adapter
Spigen iPhone 5/5s Case
Developer Laptop (Mac)