Extending Predefined ServiceNow CI modules – Part 2
Deal with Hierarchical Data in a Better Way
Last time we used a very simple filter to select data from the single table. Sometimes the provision rules can be much more complex due to the hierarchical data nature. Thus, using filters might not be the best and the soundest way to implement data import and store information in ServiceNow.
Let’s review another way to create an Informix Database Instance and make it appear in the Database Instance menu of the CI module.
Fig. 1. Database Instances menu
We’ll need to go through the following steps:
- Create a new table to collect Informix instance related data;
- Create a new CI module to be shown as a Database Instance subitem;
- Modify the transformation map to populate new table with Informix-related data;
- Validate the results.
Let’s get things done.
A (Not So) Hard Way to Extend the List of Available Database Types
(1) Create a new table to collect Informix-related data.
Go to System Definition -> Tables & Columns -> Create table
Name the new table “Informix” by filling in the Label field and make it inherit the predefined Database Instance table.
Note: Name field may vary in different cases depending on the current working Application scope.
Fig 2. Creating new table
(2) Create a new CI module and make it shown as a Database Instance subitem.
Go to System Definition -> Modules -> and create a New module.
Enter a value under the Title field that you want to be shown as a CI module name (e.g., Informix).
Enter a configuration value in the Application Menu that would be a part of a menu where the new module will be shown.
Order value defines the place in the Application Menu hierarchy where the module will be shown.
Select a newly created Informix table as a data source (a mandatory field in the table).
You don’t need to create filters this time.
Fig 3. Creating new module
(3) Modify transformation map to populate the new table with Informix related data.
In order to correctly populate new table with Informix entries during data load, the transformation map of Database Instances needs to be modified. To do this, we need to check the type of database instance in run time and assign a proper target class name for provisioning. Transformation map frame and full code listings are present in fig. 4.
Fig 4. Modifying Transformation map
(4) Validate the results.
As a result, a new submodule is now present in the Database Instances menu.
New data load and transformation map should be performed in order to populate Informix.
Fig 5. Informix is now present as a submodule in the Database Instances menu
Thank you for reading our series of blog posts on creating new items in the ServiceNow Database instances menu. Are you interested in other technical reads? Subscribe to our newsletter and stay tuned for new technical guides from Infopulse specialists!