The CreatorCon Call for Content is officially open! Get started here.

Undefined values showing in email notification

othomas1
Kilo Guru

I have an email script and a notification, my notification is showing "undefined" for certain variables i am trying to reference, does anyone know what this could be the cause of this?

Email script:

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {

var acl = new GlideRecord('u_cmdb_ci_table_access_parameters');
//var obj = JSON.parse(event.parm2);
acl.addQuery('u_number', current.sys_id);
acl.addQuery('u_class', current.sys_id);
acl.addQuery('u_group_all', current.sys_id);
acl.query();
//acl.getRowCount();
//gs.log('33');

//while(acl.next()){

email.setSubject("CMDB Group ACL Deactivated for " + acl.u_class.getDisplayValue() + " Class ");
template.print('<a href="/u_cmdb_ci_table_access_parameters.do?sys_id=' + acl.sys_id + '">' + acl.u_number + '</a>');
template.print("has been deactivated. The group" + "" + acl.u_group_all.getDisplayValue() + "" + "" + "is no longer active. + '<br/>");
template.print("Please reach out to stakeholders to identify whether a replacement" + "" + acl.u_class.getDisplayValue() + "" + "ACL is needed.<br/>");
gs.log('99');

//}
})(current, template, email, email_action, event);

 

 

 

 

find_real_file.png

12 REPLIES 12

Could you please check once that the field name and the values for the field which you are using in the script are correct or not. As Munender already mentioned, even I'm not convinced with the field name and the corresponding values which you are entering.

Also, could you please confirm that all the 3 fields which you are referring to are the reference fields?

The highlighted fields are the fields i am attempting to reference

 

find_real_file.png

 

find_real_file.png

 

find_real_file.png

 

find_real_file.png

othomas1
Kilo Guru

Hi everyone,

Removing the lines of code below:

acl.addQuery('sys_id', current.sys_id);
acl.addQuery('u_number', current.u_number);
acl.addQuery('u_class', current.u_class);
acl.addQuery('u_group_all', current.u_group_all);

 

And adding acl.addQuery('u_active', 'true');

Gets it to work.