Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

GroupingProduceGroupMainAlertHook - script include not working as expected

sgchandran
Tera Contributor

Hi , 

 

I have referred the documentation :

 https://www.servicenow.com/docs/r/it-operations-management/event-management/alert-group-use-cases.ht...

 

and configured the script accordingly in a way to return the oldest alert created as main alert for tag based clustering , but still its not accepting my change as grouping logic and following tag based clustering's grouping logic that is 

alert 1 

alert 2 

alert 3 (created on its own and alert 1 ,2 will become 3's child)

 

below is the script i used :

 

var GroupingProduceGroupMainAlertHook = Class.create();
GroupingProduceGroupMainAlertHook.prototype = {
    initialize: function() {},

    getMainAlert: function(groupAlertIDs) {
              if (!groupAlertIDs) {
         
            return null;
        }

        var gr = new GlideRecord('em_alert');
        gr.addQuery('sys_id', 'IN', groupAlertIDs);
        gr.orderBy('sys_created_on'); // oldest first
        gr.setLimit( 1 );
 
        gr.query();

        if (gr.next()) {
            return gr;
        }
        return null;
    },

    type: 'GroupingProduceGroupMainAlertHook'
};

 

 

 

0 REPLIES 0