Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

CatalogJS- Scoped

The CatalogJS API provides methods to check and retrieve catalog-specific properties.

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

Parent Topic:Server API reference

CatalogJS - Catalog(GlideRecord now_GR)

Creates an instance of the catalog class for the specified glide record object.

NameTypeDescription
now_GRObjectGlide Record pointing to the sc_catalog table.

This example shows how to create a new instance of the catalog class.

var now_GR = new GlideRecord('sc_catalog');
 now_GR.addQuery('sys_id','e0d08b13c3330100c8b837659bba8fb4');
 now_GR.query();
 var catalog = new sn_sc.Catalog(now_GR);

CatalogJS - Catalog(String sys_id)

Creates an instance of the Catalog class with the specified sys_id.

NameTypeDescription
sys_idStringSys_id of the catalog.

This example shows how to create an instance of the Catalog class wit the specified syst_id.

new sn_sc.Catalog(catalog_sys_id);
var catalog = new sn_sc.Catalog("31bea3d53790200044e0bfc8bcbe5dec");

CatalogJS - canView(Boolean mobile, String userId)

Determines whether a user can view the current category on a mobile device or desktop.

NameTypeDescription
mobileBooleanFlag that indicates whether to check if the user can view the current catalog on a mobile view or desktop view. Valid values: - true: Mobile view - false: Desktop view
userIdStringOptional. Sys\_id of the user to check if they can view the catalog.Default: Current user
TypeDescription
BooleanFlag that indicates whether the catalog is viewable by the user. Valid values: - true: Catalog is viewable by the user. - false: Catalog is not viewable by the user.

Example:

var catalog = new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
gs.info(catalog.canView(true));

Output:

true

CatalogJS - getAvailableCatalog()

Returns the available active catalog.

If only one active catalog exists, then the method returns that catalog. Otherwise, it returns the earliest catalog created from the list of the catalogs that the user can view. If no catalog is available, the method returns null.

NameTypeDescription
None  
TypeDescription
ObjectObject pointing to the earliest catalog that the user can view, or null if no catalog is available.

This example returns the catalog that is available to the current user.

var catalog = sn_sc.Catalog.getAvailableCatalog()

CatalogJS - getBackgroundColor()

Returns the catalog background color.

NameTypeDescription
None  
TypeDescription
StringBackground color of the catalog.

This example returns the background color for the associated catalog.

var catalog = new sn_sc.Catalog("0f910a2ac3112200b12d9f2974d3ae3c");
gs.info("Catalog background: " + catalog.getBackgroundColor());

Output:

Catalog background: white

CatalogJS - getCatalogCount()

Returns the number of catalogs active in the catalog table.

NameTypeDescription
None  
TypeDescription
IntegerNumber of catalogs available in the catalog table.

Example:

console.log(sn_sc.Catalog.getCatalogCount());

Output:

3

CatalogJS - getCategories()

Returns the categories for the current catalog.

NameTypeDescription
None  
TypeDescription
ArrayListReturns the categories for the current catalog.

This example returns the categories available in the current catalog object.

var catalog=new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
console.log(catalog.getCategories());

Output:

0 : {header_image: "", sys_id: "e15706fc0a0a0aa7007fc21e1ab70c2f", description: "Your IT gateway. Report issues and submit requests.", title: "Can We Help You?"} 
1 : {header_image: "", sys_id: "95fc11615f1211001c9b2572f2b477c6", description: "Services offered by different departments in the organization", title: "Departmental Services"} 
2 : {header_image: "", sys_id: "900682363731300054b6a3549dbe5d5f", description: "Desktop computers for your work area.", title: "Desktops"} 
3 : {header_image: "", sys_id: "d2f716fcc611227a015a142fa0b262c1", description: "Order new furniture, and fixtures, or request for cubicle modifications can also be ordered here.", title: "Furniture and Decor"} 
4 : {header_image: "", sys_id: "d258b953c611227a0146101fb1be7c31", description: "Order from a variety of hardware to meet your business needs, including phones, tablets and laptops.", title: "Hardware"} 

CatalogJS - getCategoryIds()

Specifies the sys_ids of the categories in the current catalog.

NameTypeDescription
None  
TypeDescription
ArrayListReturns the sys_ids of the categories in the current catalog.

This example returns the sys_ids of the categories available in the current catalog.

var catalog=new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
console.log(catalog.getCategoryIds());

Output:

0:"e15706fc0a0a0aa7007fc21e1ab70c2f"
1 : "95fc11615f1211001c9b2572f2b477c6"
2 : "900682363731300054b6a3549dbe5d5f"
3 : "d2f716fcc611227a015a142fa0b262c1"

CatalogJS - getDescription()

Returns the description of the current catalog.

NameTypeDescription
None  
TypeDescription
StringCatalog description.

This example returns the name of the current catalog.

var catalog=new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
console.log(catalog.getDescription());

Output:

Service Catalog - IT Now

CatalogJS - getDesktopImageSRC()

Returns the catalog desktop image file name.

NameTypeDescription
None  
TypeDescription
StringCatalog desktop image file name.

This example returns the current catalog desktop image file name.

var catalog=new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
console.log(catalog.getDesktopImageSRC());

Output:

adbcc271475211002ee987e8dee49001.iix

CatalogJS - getGr()

Returns the current catalog's GlideRecord.

NameTypeDescription
None  
TypeDescription
GlideRecordGlideRecord of the current catalog.

This example returns the GlideRecord for the specified catalog.

var catalog = new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
data.history = catalog.getGr();

CatalogJS - getHeaderIconSRC()

Returns the current catalog's header icon.

NameTypeDescription
None  
TypeDescription
StringCatalog header icon.

This example shows how to obtain the name of the catalog header icon.

var catalog=new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
gs.info(catalog.getHeaderIconSRC());

Output:

service_catalog_header.png

CatalogJS - getID()

Returns the sys_id of the current catalog.

NameTypeDescription
None  
TypeDescription
StringSys_id of the current catalog.

This example returns the sys_id of the current catalog.

var catalog=new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
console.log(catalog.getId());

Output:

e0d08b13c3330100c8b837659bba8fb4

CatalogJS - getTitle()

Returns the title of the current catalog.

NameTypeDescription
None  
TypeDescription
StringTitle of the current catalog.

This example returns the title of the current catalog.

var catalog=new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
gs.info(catalog.getTitle());

Output:

Service Catalog

CatalogJS - hasCategories()

Specifies if the current catalog has categories.

NameTypeDescription
None  
TypeDescription
BooleanFlag that indicates whether the current catalog has categories. Valid values: - true: Catalog has categories. - false: Catalog does not have categories.

This examples shows how to determine if the current catalog contains categories.

var catalog=new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
gs.info(catalog.hasCategories());

Output:

false

CatalogJS - hasItems()

Specifies if the current catalog has catalog items.

NameTypeDescription
None  
TypeDescription
BooleanFlag that indicates whether the current catalog has catalog items. Valid values: - true: Catalog has catalog items. - false: Catalog does not have catalog items.

Example:

var catalog=new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
gs.info(catalog.hasItems());

Output:

true

CatalogJS - isWishlistEnabled()

Specifies if the wish list is enabled for the current catalog.

NameTypeDescription
None  
TypeDescription
BooleanFlag that indicates whether the current catalog supports wish lists. Valid values: - true: Catalog supports wish lists. - false: Catalog does not support wish lists.

This example shows how to check if a wish lists are enabled for the current catalog.

var catalog = new sn_sc.Catalog("e0d08b13c3330100c8b837659bba8fb4");
gs.info(catalog.isWishlistEnabled());

Output:

true