Need help in email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi Team ,
can anyone please help me on this
Daily we are doing ServiceNow health check up - data will capture in a xls .
we have created a custom table
and once the record submitted we need trigger a notification
we want to add coloring format based on the value selected for exmple - mid server down means Red color -
if UP green color
like below
please help me how to do this
please provide me the configuration steps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
what did you start from your side and where are you stuck?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @nameisnani ,
Please refer below links that will help you!
Please review and try to implement !!
If you found my response helpful, please mark it as helpful and accept it as the solution.
Thank you
Nawal Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
(function() {
function getColor(status) {
if (status == 'DOWN') return '#ff4d4d'; // Red
if (status == 'UP') return '#4CAF50'; // Green
return '#d9d9d9'; // Grey (for unknown)
}
var html = '';
html += '<table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;width:80%;">';
html += '<tr style="background-color:#f2f2f2;"><th>Field</th><th>Status</th></tr>';
// MID Server - Prod
html += '<tr>';
html += '<td><b>MID Server - Prod</b></td>';
html += '<td style="background-color:' + getColor(current.u_mid_prod_status) + ';color:white;text-align:center;">' +
current.u_mid_prod_status + '</td>';
html += '</tr>';
// MID Server - Stag
html += '<tr>';
html += '<td><b>MID Server - Stag</b></td>';
html += '<td style="background-color:' + getColor(current.u_mid_stag_status) + ';color:white;text-align:center;">' +
current.u_mid_stag_status + '</td>';
html += '</tr>';
// MID Server - Dev
html += '<tr>';
html += '<td><b>MID Server - Dev</b></td>';
html += '<td style="background-color:' + getColor(current.u_mid_dev_status) + ';color:white;text-align:center;">' +
current.u_mid_dev_status + '</td>';
html += '</tr>';
html += '</table>';
html += '<br>Regards,<br><b>ServiceNow Health Check Automation</b>';
return html;
})();
})(current, template, email, email_action, event);
this is the script i tired
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
looks fine to me
what debugging did you do?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
