Skip to main content

IMPORTANT - Product End of Life Statement - IMPORTANT

Request RE, Survey, and Calendar 1.5 Support Ending December 31, 2020
Contact Kinetic Data Support with Questions
Kinetic Community


Check and create categories within an existing catalog



Use these functions when you want to create categories within an existing catalog?


# Returns true/false whether or not the specified category exists in the specified catalog.
def category_exists?(catalog_name, category_name)
  category = Kinetic::RequestAPI::Category.find(catalog_name, category_name)

# Creates a new category in the specified catalog.
def create_category(catalog_name, category_name, description=nil, status='Active', sort_order=nil)
  # Note that this will raise an exception if the catalog does not exist.
  catalog = Kinetic::RequestAPI::Catalog.find(catalog_name)

  # Create a new category instance.
  category ={
    'Category'            => category_name,
    'ServiceCatalog'      => catalog_name,
    'Status'              => status,
    'CategoryDescription' => description,
    'SortOrder'           => sort_order
  # Set the catalog id field.  Note that this option cannot be set via the constructor.
  category.fields['CatalogInstanceID'] = catalog.category_fields['instanceId']

  # Save the new category.

Example of category_exists?

category_exists?('ACME IT', 'Hardware')

Examples of create_category

create_category('ACME IT', 'Hardware')
create_category('ACME IT', 'Hardware', 'description of catalog', 'Active', '2')

When to use this feature?

Use this feature when you want to add additional categories (and possibly templates) to an existing catalog. Normally with KURL - categories are only created at catalog create time. These functions allow you to add a category after a catalog exists.