3

For e.g. , I want to create a catalog items under a category named "Backpack".Let's say I want to create a "Catalog Item" named "American Tourister" under the "Category" named "Backpack".I want to add the attributes like "colour","type" of these catalog items in the form of "Variables". I have these values stored in my database.And data gets add up in the incremental form in database. Is there any "Out of the Box API" in ServiceNow to create "Catalog Item" and its "Variables" using that out of box api,so that I can create catalog item and variables using data in my database.

Ishaan
  • 31
  • 2

2 Answers2

2

For the latest 2 version (Jakarta and Istanbul) yes there is a set of classes for creating and manipulating catalog items, catalog categories, variable sets and variables, (CatItem, CatCategory, CatalogItemVariable, CatalogItemVariableSet, CatalogItemVariableSetM2M) please visit the official documentation for the server side APIs

I don't know about the other version but in case they are not there you can still make use of the GlideRecord API to manually do all this stuff, for example:

var catItemGr = new GlideRecord('sc_cat_item');

catItemGr.initialize();
catItemGr.setValue('name', 'American Tourister');
catItemGr.setValue('short_description', 'American Tourister Stuff');
catItemGr.setValue('category', 'sys_id for the category Backpack');

catItemGr.insert();

The above snippet can be used to create a new catalog item programmatically, you can set up the variables, variable sets and the relations using the same way

Abdo Adel
  • 1,177
  • 2
  • 17
  • 30
0

Via the REST API Explorer you can use the Namespace sn_sc to access the Service Catalog API. Use this path to get to it: https://.service-now.com/$restapi.do?ns=sn_sc&service=Service Catalog API&version=v1

You'll find the available operations on this page.

Iain D.
  • 11
  • 1