Upgrading from a previous version of the gateway

There are important changes required when upgrading to version 5.0 of IBM Tivoli Netcool/OMNIbus Java Gateway for ServiceNow.

Users upgrading from a previous version of the gateway to version 5.0 must take note and apply the latest changes in the following files.

servicenow.map

The servicenow.map file has been updated with lookup values for the new Incident state model in ServiceNow. The new Incident state model is available by default in ServiceNow from the Helsinki version onwards.

servicenow.map for version 5.0 of the gateway.

CREATE LOOKUP StateTable
(
	0 = 6
) DEFAULT = 1; 

CREATE LOOKUP ImpactTable 
(
    {3,2},
    {4,2},
    {5,1}
) DEFAULT = 3;

CREATE LOOKUP UrgencyTable
(
    {0,3},
    {1,3},
    {2,2},
    {3,2},
    {4,1},
    {5,1}
) DEFAULT = 3;

CREATE MAPPING StatusMap
(
    'opened_at'         = '@FirstOccurrence' CONVERT TO DATE ON INSERT ONLY,
    'short_description' = '@Summary' ON INSERT ONLY,
    'state'             = Lookup(StateTable, coalesce('@Severity','1')),
    'impact'            = Lookup(ImpactTable, '@Severity') ON INSERT,UPDATE ONLY,
    'urgency'           = Lookup(UrgencyTable, '@Severity') ON INSERT,UPDATE ONLY,
    'sys_id'            = '@ServiceNowSysId' INTERNAL ONLY, # DO NOT UPDATE OR REMOVE
    'severity'          = '@Severity' INTERNAL ONLY,
    'lastoccurrence'    = '@LastOccurrence' INTERNAL ONLY,
    'tally'             = '@Tally' INTERNAL ONLY,
    'acknowledged'      = '@Acknowledged' INTERNAL ONLY,
    'serverName'        = '@ServerName' INTERNAL ONLY, # DO NOT UPDATE OR REMOVE
    'serverSerial'      = '@ServerSerial' INTERNAL ONLY, # DO NOT UPDATE OR REMOVE
    'work_notes'        = 'Alert deleted in the Object Server' ON DELETE ONLY

) DEDUPLICATE ('severity','lastoccurrence','tally','acknowledged');

CREATE MAPPING JournalMap
(
    'work_notes'	= replace(JOURNAL.TEXT,"\n","\\n"),
    'uid'               = JOURNAL.UID INTERNAL ONLY,
    'chrono'            = JOURNAL.CHRONO INTERNAL ONLY,
    'serverName'        = STATUS.SERVER_NAME INTERNAL ONLY, # DO NOT UPDATE OR REMOVE
    'serverSerial'      = STATUS.SERVER_SERIAL INTERNAL ONLY # DO NOT UPDATE OR REMOVE
);

servicenow.notification.js

The inboundUpdate() function now updates the ObjectServer table with the close_code and close_notes data from ServiceNow.

servicenow.notification.js for version 5.0 of the gateway.

// Update an alert with data received from ServiceNow
//
// Params:
//   alert - The alert being updated
//   inputs - Input values, as a name/value map, for the update
function inboundUpdate(alert,inputs)
{
	try {
		// Dates can be parsed using dateformat.parse.
		// The format used is as used by the Java SimpleDateFormat class.
		// http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
		//
		// Example:
		// var resolvetime = dateformat.parse("dd/MM/yyyy' 'HH:mm:ss", inputs.get("ResolveTime"));
		values = sog.newrow();
		values.put("ServiceNowState", inputs.get("state"));
		values.put("TTNumber", inputs.get("number"));
		values.put("CloseCode", inputs.get("close_code"));
		values.put("CloseNotes", inputs.get("close_notes"));
		alert.update(values);
		if( null == inputs.get("sys_id") ) {
			addJournal(alert, "Ticket updated in ServiceNow with TTNumber: " + inputs.get("number") + " and state: " + inputs.get("state"));
		} else {
			addJournal(alert, "Ticket updated in ServiceNow with SysId: " + inputs.get("sys_id") + " and TTNumber: " + inputs.get("number") + " and state: " + inputs.get("state"));
		}
	} catch(err) {
		logError(alert, "Unable to update alert in OMNIbus: " + err);
	}
}

See ServiceNow incident resolution for more details.

G_SERVICENOW.props

The gateway properties file introduces the following new properties:

  • Gate.ServiceNow.AuthenticationType
  • Gate.ServiceNow.ClientId
  • Gate.ServiceNow.ClientSecret

For descriptions of these new properties, see Properties and command line options

servicenow.sql

The servicenow.sql file has been updated to add new columns CloseCode and CloseNotes to the alerts.status table.

alter table alerts.status add column CloseCode varchar(64);
go
alter table alerts.status add column CloseNotes varchar(64);
go

See ServiceNow incident resolution for more details.

The alerts.conversions table has been updated with new values for the latest Incident state model in ServiceNow:

insert into alerts.conversions values ('ServiceNowState1','ServiceNowState',1,'New');
insert into alerts.conversions values ('ServiceNowState2','ServiceNowState',2,'In Progress');
insert into alerts.conversions values ('ServiceNowState3','ServiceNowState',3,'On Hold');
insert into alerts.conversions values ('ServiceNowState6','ServiceNowState',6,'Resolved');
insert into alerts.conversions values ('ServiceNowState7','ServiceNowState',7,'Closed');
insert into alerts.conversions values ('ServiceNowState7','ServiceNowState',8,'Canceled');
go
Note:

Before running the SQL in servicenow.sql, delete the previous rows from the alerts.conversions table:

delete from alerts.conversions where Colname=’ServiceNowState’;