CatItem - Scoped

CatItem API enables you to create and modify service catalog items using scripts.

CatItem - canViewOnSearch(boolean isMobile)

Specifies if the user has access to view the catalog item on global search.

Table 1. Parameters
Name Type Description
isMobile Boolean True if the search is in mobile view. Else, false.
Table 2. Returns
Type Description
Boolean Returns true if the user has access to view the catalog item on global search. Else, returns false.

Example:

var cart=new sn_sc.CatItem("04b7e94b4f7b4200086eeed18110c7fd");	
	data.history=cart.canViewOnSearch('false');

Output:

false

CatItem - getFirstAccessibleCategoryForSearch(String catalogId)

Specifies the first category that the user can view in a catalog.

Table 3. Parameters
Name Type Description
catalogId String sys_id of the catalog.
Table 4. Returns
Type Description
String sys_id of the first category that the user can view in a catalog.

Example:

var CatItem=new sn_sc.CatItem("04b7e94b4f7b4200086eeed18110c7fd");	
	console.log(CatItem.getFirstAccessibleCategoryForSearch("e0d08b13c3330100c8b837659bba8fb4”));

Output:

d258b953c611227a0146101fb1be7c31

CatItem - getRecordClass()

Returns the class name for the current catalog item record.

Table 5. Parameters
Name Type Description
None
Table 6. Returns
Type Description
String Class name for the current catalog item record.

Example:

var CatItem=new sn_sc.CatItem("04b7e94b4f7b4200086eeed18110c7fd");	
	console.log(CatItem.getRecordClass());

Output:

sc_cat_item

CatItem - isVisibleServicePortal()

Specifies if the catalog item is available in service portal.

Table 7. Parameters
Name Type Description
None
Table 8. Returns
Type Description
Boolean Returns true if the catalog item is available in service portal. Else, returns false.

Example:

var CatItem=new sn_sc.CatItem("04b7e94b4f7b4200086eeed18110c7fd");	
	data.history=CatItem.isVisibleServicePortal();

Output:

true

Scoped CatItem - availableForUserCriteria(String action, Array[] criteriaIDs)

Adds the Available For user criteria to a catalog item.

Table 9. Parameters
Name Type Description
action string Specify add to add the user criteria to the Available For list.

Specify delete to delete the user criteria from the Available For list.

criteriaIDs Array Array of the user criteria sys_ids.
Table 10. Returns
Type Description
void
var item = new sn_sc.CatItem("31bea3d53790200044e0bfc8bcbe5dec");
item. availableForUserCriteria("add", ["0c441abbc6112275000025157c651c89"]);

Scoped CatItem - notAvailableForUserCriteria(String action, Array[] criteriaIDs)

Adds the Not Available For user criteria to a catalog item.

Table 11. Parameters
Name Type Description
action String Specify add to add the user criteria to the Not Available For list.

Specify delete to delete the user criteria from the Not Available For list.

Table 12. Returns
Type Description
void
var item = new sn_sc.CatItem("31bea3d53790200044e0bfc8bcbe5dec");
item. notAvailableForUserCriteria("add", ["0c441abbc6112275000025157c651c89"]);

CatItem - create(Boolean standardUpdate)

Insert the defined catalog item.

Table 13. Parameters
Name Type Description
standardUpdate Boolean Set to true to enable the running of engines and workflow.
Table 14. Returns
Type Description
void


      
    

CatItem - delete(Boolean standardUpdate)

Delete the defined catalog item.

Table 15. Parameters
Name Type Description
standardUpdate Boolean Set to true to enable the running of engines and workflow.
Table 16. Returns
Type Description
void


      
    

CatItem - read(Object columns, Boolean standardUpdate)

Get a mapping of catalog item attribute values.

Table 17. Parameters
Name Type Description
standardUpdate Boolean Set to true to enable the running of engines and workflow.
columns Object Specify the set of columns that you would like the values for.
Table 18. Returns
Type Description
Object An object mapping column names to values.


      
    

CatItem - setAttributes(Object attributes)

Define attribute values for this catalog item.

Table 19. Parameters
Name Type Description
attributes Object An object mapping column names to values.
Table 20. Returns
Type Description
void


      
    

CatItem - setCatalogs(String catalogs)

Define the catalogs that this catalog item is associated with.

Table 21. Parameters
Name Type Description
catalogs String Specify comma-separated list of catalogs that you would like the item to be associated with.
Table 22. Returns
Type Description
void


      
    

CatItem - setCategories(String categories)

Define the categories that this catalog item is associated with.

Table 23. Parameters
Name Type Description
categories String Specify comma-separated list of categories that you would like the item to be associated with.
Table 24. Returns
Type Description
void


      
    

CatItem - setImage(String dbImageSysId, String type)

Set the image of a catalog item to a database image record.

Table 25. Parameters
Name Type Description
dbImageSysId String sys_id of an attachment referencing the db_image.
type String Type can be picture or an icon.
Table 26. Returns
Type Description
void


      
    

CatItem - setTableName(String tableName)

Define the table name for this catalog item.

Table 27. Parameters
Name Type Description
tableName String Specify the name of the table that extends sc_cat_item.
Table 28. Returns
Type Description
void


      
    

CatItem - update(Object columnValues, Boolean standardUpdate)

Use to update current catalog item with set values.

Table 29. Parameters
Name Type Description
columnValues Object An object mapping column names to values.
standardUpdate Boolean Set to true to enable the running of engines and workflow.
Table 30. Returns
Type Description
void