Issue with Customizing Alarm Management API for Event Severity Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2025 04:24 AM - edited 03-16-2025 04:29 AM
Hi everyone,
I’ve been working with the Alarm Management Open API in ServiceNow and am trying to customize the mapping for the event severity. Specifically, I want to override the severity field during event creation to always set the severity to "Critical" when certain conditions are met. However, the severity is not updating as expected, and I’m not sure what I'm missing in my customization.
Here’s what I’ve done so far:
- I extended the AlarmAPIProcessor class to override the default field mapping for severity using the mapCreateAlarmObjectToEvent function.
- I ensured the function is called by replacing the default function from AlarmAPIProcessorOOB.
Here's my code for overriding the severity field mapping:
var AlarmAPIProcessor = Class.create();
AlarmAPIProcessor.prototype = Object.extendsObject(AlarmAPIProcessorOOB, {
// Overriding mapCreateAlarmObjectToEvent to change the severity
mapCreateAlarmObjectToEvent: function(eventGr, eventObject){
// Custom mapping logic for severity field
if (eventObject.alarmType == 'SystemFailure') {
eventGr.severity = "Critical"; // Force severity to Critical if event is a system failure
}
},
type: 'AlarmAPIProcessor'
});
Even though the code should update the severity field when the alarm type is "SystemFailure," the severity is not being set as "Critical" in the event records.
I’ve also made sure that my custom function is correctly overriding the default, but it still doesn’t seem to work. The field mapping is not being applied, and I can't figure out why. Has anyone encountered a similar issue or knows what might be going wrong?
For reference, I’m using the (https://www.servicenow.com/docs/bundle/yokohama-api...) for my implementation.
Thanks in advance for any help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 06:16 PM
In the mapCreateAlarmObjectToEvent function in the 'AlarmAPIProcessorOOB' script include it is defined as:
mapCreateAlarmObjectToEvent: function(eventGr, eventObject){
function definition?