Vishal Birajdar
Giga Sage

Hello joao_graca,

can you try this...!!

In the mail script you can get value of  "u_notes" by using current object. then you can call errorReport function

 

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

//Get the value of notes
var status = current.u_notes;

//call the function
errorReport(status);


function errorReport(status){

if (status >= 400 && status < 499) {

template.print("<p>Client Error!</p>");

} else if (status >= 500 && status< 599) {

template.print("<p>Server Error!</p>");

} else {

template.print("<p>Error!</p>");

}

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

 

Notification  body : 

HTTP Status: ${u_notes}

${mail_script:ErrorReportNotificationScript}

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

View solution in original post