Mail is not triggering even though mail id is retrieving correctly

nandini29
Tera Expert

 

There is a requirement to trigger an email notification to the Business Application Owner when an incident is resolved. To fulfill this requirement, I developed a Mail Script and included log statements to verify that the script is executing as expected.

Based on the system logs, I can confirm that the script is running and that the email address is being retrieved correctly. However, despite this confirmation, the email notification is not being sent to the Business Application Ownerand user is active

The current Mail Script is provided below for reference:

 

 
 
(function runMailScript(current, template, email, email_action, event) {

if (!current.u_application)
return;

var appGR = new GlideRecord('cmdb_ci_business_app');
appGR.addQuery('sys_id', 'IN', current.u_application);
appGR.query();

gs.info('Mail script triggered for Sev1/Sev2 incident.');

while (appGR.next()) {
var ownerGR = appGR.u_it_system_owner.getRefRecord();
email.addAddress("to", ownerGR.email.toString(), ownerGR.email.toString());
gs.info('Owner email: ' + ownerGR.email.toString());
}


})(current, template, email, email_action, event);
 
1 REPLY 1

yashkamde
Kilo Sage

Hello @nandini29 ,

 

The mail script is fine, plz check the notification setup..

If my response helped mark as helpful and accept the solution.