Defining custom Config Item classes in OTRS CMDB

Updated on 06th December 2017

There are five types of configuration items (CIs)available in OTRS by default which are Computer, Hardware, Network, Software and Location. The asset portfolio of a modern day IT department consists of a lot many items that may not actually fit into any of those five broader categories. Let's take the example of a Company mobile phone, to add a mobile phone in OTRS CMDB you can select the class as Computer and set the type field to Phone. But the information we need to capture for a mobile phone such as the IMEI number, warranty end date, upgrade date, type, OS version etc., is different from the information we would need about a desktop computer. This means we need to create a new Config Item class to manage mobile phones. This article guides you on how to add a custom Config item class in OTRS.

1. First of all login to OTRS using an account that has admin privileges.

2. Click Admin tab and then on the General Catalog link.

General Catalog

3. In the General Catalog Management page click Config Item Class.

General Catalog Management

4. Click Add Catalog Item on the Actions panel.

Add Catalog Item

5. Input as below and click the Submit button.

  • Name: Mobile
  • Permission: itsm-configitem
  • Validity : Valid
New Catalog Item

6. Next, we will create another class that defines various Mobile Operating Systems types. Click General Catalog link again and click Add Catalog Class from the Action panel on the left.

Add Catalog Class

7. Input as below and click the Submit button.

  • Catalog Class: ITSM::ConfigItem::Mobile::Type
  • Name: Android
  • Validity : Valid

This will create the Config Item class Mobile::Type and adds a catalog item named Android.

New Catalog Class

Repeat this step to add catalog items for other Operating systems like IOS, Nokia Symbian etc.,

8. Go back to the Admin page and click Config Items link.

Config Items

9. In the Config Item Management screen, click on Mobile

Config Item Management

10. Click Change class definition button in the Actions panel and then we can add definitions for following fields to the Mobile class.

  • Phone Number
  • Owner
  • Make
  • Model
  • Operating System
  • IMEI Number
  • Activation Date
  • Warranty End Date
Change Class Definition

Input the following in the Definition box and click Submit. The keys used in this class definition are explained at the end of this article.

[
   {
    Key => 'PhoneNumber',	
	Name => Translatable('Phone Number'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Required => 1,
	    Size => 15,
	    MaxLength => 15,
		},
    },
    {
	Key => 'Owner',
	Name => Translatable('Owner'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Required => 1,
 	    Size => 50,
 	    MaxLength => 50	,
		},
    },
    {
	Key => 'Make',
	Name => Translatable('Make'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Size => 30,
 	    MaxLength => 30,
		},
  },
  {
	Key => 'Model',
	Name => Translatable('Model'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Size => 30,
 	    MaxLength => 30,
		},
  },
  {
	Key => 'OperatingSystem',
	Name => Translatable('Operating System'),
	Searchable => 1,
	Input => {
 	    Type => 'GeneralCatalog',
 	    Class => 'ITSM::ConfigItem::Mobile::Type',
 	    Translation => 1,
		},
  },
  {
	Key => 'IMEINumber',
	Name => Translatable('IMEI Number'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Size => 15,
 	    MaxLength => 15,
		},
  },
  {
	Key => 'ActivationDate',
	Name => Translatable('Activation Date'),
	Searchable => 1,
	Input => {
 	    Type => 'Date',
 	    Required => 1,
 	    YearPeriodPast => 20,
 	    YearPeriodFuture => 10,
		},
   },
   {
	Key => 'WarrantyExpirationDate',
	Name => Translatable('Warranty Expiration Date'),
	Searchable => 1,
	Input => {
 	    Type => 'Date',
 	    YearPeriodPast => 20,
 	    YearPeriodFuture => 10,
		},
	},
   ]

11. You have now completed adding a new CI class named Mobile. To add a new CMDB items of type Mobile, Click CMDB in the menu bar and select New.

New CMDB Item

12. You will be presented with a form which displays all the fields that you have defined in the Mobile class.

Add CMDB Item

Config Item Class Attributes

In the config item class definition, you define a set of fields and their attributes as key/value pairs. There is a set of pre-defined attributes that are allowed in a class definition. These are:

  • Key : This is unique id given to a field.
  • Name : This is the field name. It is used as a label for the field.
  • Searchable : Makes a field searchable if value is 1. Default is 0, not searchable.
  • Input : Defines the field input type and related attributes. The following attributes are allowed.
    • Type: Field type which can be any one of the following
      • Text
      • Textarea
      • Integer
      • Date
      • DateTime
      • Customer
      • CustomerCompany
      • GeneralCatalog
      • Dummy
    • Required: Makes a field mandatory to input before submitting the form. Value 1 means mandatory. Default is 0, not mandatory.
    • MaxLength : Defines the maximum number of characters on text fields.
    • ValueDefault : Specifies a default value for the field.
    • ValueMin : Specifies a minimum value when input type is integer.
    • ValueMax : Specifies a maximum value when input type is integer.
    • YearPeriodFuture : Defines the number of years in future to be displayed when input type is date or datetime.
    • YearPeriodPast : Define the number of years in past to be displayed in date when input type is date or datetime.

Editors Note : This content is sponsored by Paperboat IT Solutions - OTRS Consultants


Post a comment

Comments

Nothing yet..be the first to share wisdom.