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

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hi @jobin1 

you will have to write notification email script and access the same by using ${mail_script:script name} in the script field.

refer docs: https://docs.servicenow.com/bundle/rome-servicenow-platform/page/script/server-scripting/concept/c_U...

 

please hit thumb up below and mark the answer as correct if it helped!!

 

Regards,

Ravi Chandra.

Namrata Ghorpad
Mega Sage
Mega Sage

Hi @jobin1 ,

Instead of writing Javascript code in HTML field create one Email script and in that write your code and call the email script in your email notification HTML part like below.

${mail_script:email_script_name}

Please refer the below link as well.

https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/script/server-scripting/concept... 

 

Please mark my answer as helpful/correct if it helps you.

Regards,

Namrata

@Namrata Ghorpad it seems we replied the exact thing with 5 seconds gap 😀

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hi @jobin1 

Any feedback on my reply?

If the solution proposed worked for you, if yes mark the answer as correct and close the thread.

 

Regards,

Ravi Chandra.