Amit Gujarathi
Giga Sage

HI @jobin1 ,
I trust you are doing fine.
To pass the instance name in the subject of the notification, you can modify the existing notification email script as follows:

(function runMailScript(current, template, email, email_action, event) {
    var instancename1 = gs.getProperty("instance_name");
    gs.log("testcountisstarting");
    
    var event = new GlideRecord('sysevent');
    event.addEncodedQuery('sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^stateNOT INprocessed,error,transferred^processedISEMPTY');
    event.query();
    
    if (event.next())
        gs.log("ifevent");
    
    var count = event.getRowCount();
    gs.log("testcountis" + count);
    
    if (count >= 1) {
        var count2 = event.getRowCount();
        var subject = instancename1 + " - Event Processing is Stuck";
        var body = instancename1 + " event processing is stuck. Please check. The event count is " + count2;
        template.print(body, subject);
    }
})(current, template, email, email_action, event);

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi