Using the alert functions defined in bmc_remedy.notification.js

Use the alert functions defined in the bmc_remedy.notification.js file to perform a variety of operations on Tivoli Netcool/OMNIbus alerts. The alert functions are called by the Java Gateway for BMC Remedy ARS.

Overview

The bmc_remedy.notification.js file defines a variety of alert functions that operate on Tivoli Netcool/OMNIbus alerts. The file also imports functionality from several modules. The alert functions supplied in the bmc_remedy.notification.js file define a basic default behaviour for each of those functions. You can modify these alert functions to suit your environment.

The following sections discuss each of the imported modules and alert functions defined in the bmc_remedy.notification.js file.

Imported modules

The bmc_remedy.notification.js file uses the require function to load the following modules:

  • Gateway log manager service -- Made available through the logger variable
  • Simple OMNIbus Gateway (SOG) interface module -- Made available through the sog variable
  • dateformat module -- Made available through the dateformat variable
  • bmc_remedy module -- Made available through the remedy variable

The SOG interface module exposes the following method:

  • newrow -- Returns an empty row that is ready to be populated.

The bmc_remedy module exposes the following method (through the bmc_remedy.js file):

  • getEntry -- Returns the BMC Remedy ARS entry identified by the requestid from the configured form. For example:
    var remedy = require("bmc_remedy");
    .
    .
    .
    var entry = remedy.getEntry("00000001232");
    var field = entry.getField("fieldid");

The bmc_remedy module allows for calling back into BMC Remedy ARS to retrieve details of BMC Remedy ARS requests.

The addJournal function

The gateway calls the addJournal function to add a journal entry in the journal table for the alert specified in alert.

The addJournal function is defined as follows:

function addJournal(alert,message)
  • alert -- Specifies the alert within Tivoli Netcool/OMNIbus for which you want to add a journal entry in the journal table.
  • message -- Specifies a message to be concatenated after the following string:

    Generated by Remedy Gateway:

The update function

The gateway calls the update function whenever it receives a notification from the target system. In the case of BMC Remedy ARS this notification is the result of a ticket modification. The update function is defined as follows:

function update(alert,inputs)
  • alert -- Specifies the alert within Tivoli Netcool/OMNIbus that is being updated.
  • inputs -- Specifies the actual update from the target system (in this case, BMC Remedy ARS). This update is a name/value map of updated values. These names are in the target system namespace, which might not correspond to the names of columns in the Tivoli Netcool/OMNIbus alert, so values need to be converted from one namespace to the other. This requires creating an empty update row (by calling the sog.newrow method).

The following example shows a call to the update function:

function update(alert, inputs)
{
        values = sog.newrow();
        values.put("Severity", inputs.get("Severity"));
        alert.update(values);
}

The clear function

The gateway calls the clear function whenever the target ticket is deleted or cleared, in which case the gateway clears the Tivoli Netcool/OMNIbus alert. In the case of BMC Remedy ARS, the gateway performs the clear operation when the end user deletes the target BMC Remedy ARS ticket, as there is no open or closed status. The clear function is defined as follows:

function clear(alert,inputs)
  • alert -- Specifies the alert within Tivoli Netcool/OMNIbus.
  • inputs -- Specifies the actual values from the BMC Remedy ARS ticket.

The error function

The gateway calls the error function whenever an error occurs when the gateway tries to manipulate the corresponding ticket in the target system (in this case, BMC Remedy ARS). The error function is defined as follows:

function error(alert,inputs, message)
  • alert -- Specifies the alert within Tivoli Netcool/OMNIbus.
  • inputs -- Specifies the actual values from the BMC Remedy ARS ticket.
  • message -- Specifies the error message text. This error message text can be added to a journal entry for the alert (by calling the addJournal method), for example, to identify the problem to the end user.

The setTargetId function

The gateway calls the setTargetId function whenever the alert is associated with a destination target system ticket. Typically, the gateway calls setTargetId after the user creates a BMC Remedy ARS ticket and a corresponding creation ticket alert is generated. The setTargetId function sets the target ID in the underlying alert and adds the target ID details to a journal entry for the alert (by calling the addJournal method).

The setTargetId function is defined as follows:

function setTargetId(alert,targetid)
  • alert -- Specifies the alert within Tivoli Netcool/OMNIbus.
  • targetid -- Specifies a string representation of the id. In the case of BMC Remedy ARS, this string is the request id of the form entry.

The logError function

The gateway calls the logError function to log errors associated with the alert specified in alert. The logError function actually calls the error method, which is implemented as part of the Tivoli Netcool/OMNIbus Logger interface. The gateway writes errors to the gateway log file.

The logError function is defined as follows:

function logError(alert, msg)
  • alert -- Specifies the alert within Tivoli Netcool/OMNIbus to which the error message specified in msg applies.
  • msg -- Specifies a message to be concatenated after the following string:

    Alert [ServerName,ServerSerial]: