can we use java script in notification Message HTML part?

jobin1
Tera Expert

Hi All


can we use java script in the notification Message HTML part?

 

i need to validate the below script

 

var limit2 = gs.getProperty('css_emailticket_emlthreshold');
var attach = event.parm2;
//var attach = current.event_name;
 
var value2 = attach.split(",");
var smapi = value2[0];//non di value
var di = value2[1];//di value
 
if (!(smapi < limit2)) {
${report:reportID:8862a43a4788d51055baca72e36d43af:xls}
 
}
if (!(di < limit2)) {
${report:reportID:5a0e203f4723ed1055baca72e36d4323:xls}
}
 
 

jobin1_0-1687965247872.png

 

8 REPLIES 8

Hi Rvai,
Thanks for the response

But I have to send it as an Excel attachment of the sys report so that's why checking in the notification itself so what is the best option now in this case?

Hi @jobin1 

you can follow the thread shared by Omkar.

you can query through attachment table in mail script as shown in the thread.

if it is still not adding attachment, try below steps after adding the mail script:

- Click on "Advance View" in the notification under related link.

- Go to "What it will contain" tab. Enable "Include Attachment" and save.

 

Regards,

Ravi Chandra.

Hi Ravi,

I tried the below script in the notification email script but not working

 
//jm start
 
 
if (!(attach1 < limit2)) {
gs.log("attach1if");
 
var smapireportSysID = "8862a43a4788d51055baca72e36d43af"; 
  email.addAttachment(smapireportSysID);
gs.log("afteratt1print");
}
if (!(attach2 < limit2)) {
gs.log("attach2if");
 
var direportSysID = "5a0e203f4723ed1055baca72e36d4323"; 
  email.addAttachment(direportSysID);
gs.log("afteratt2print");//no logs here
}
 
 
//jm ends
 

Omkar Mone
Mega Sage

Hello,

 

Maybe this is what you are looking for - https://www.servicenow.com/community/now-platform-forum/help-with-notification/m-p/1088847

 

Regards,

Omkar