- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 11:17 AM
Dear All,
We are triggering email notification after state is resolve of an incident. The sample notification is like below-
"Your incident INC0000001 has been resolved.The incident will automatically close in 5.0 days"
Here it shows auto close day in decimal. I want to change it only to integer. Please help me.
Regards,
Nandan
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 02:00 PM
Can you try this in email script and see if it works
(function runMailScript(current, template, email, email_action, event) {
template.print('<p><font size="5" color="#808080" face="helvetica">');
template.print(gs.getMessage('Your incident has been resolved.'));
template.print('</font></p>');
template.print('<p><font size="4" color="#808080" face="helvetica">');
template.print(gs.getMessage('The incident will automatically close '));
var days = parseInt(gs.getProperty("glide.ui.autoclose.time"));
var hours = days * 24;
if (days == 0)
template.print(gs.getMessage('now'));
else if (days <= 3) {
if(hours == 1)
template.print(gs.getMessage('in {0} hour', hours.toString()));
else
template.print(gs.getMessage('in {0} hours', hours.toString()));
}
else {
if(days == 1)
template.print(gs.getMessage('in {0} day', days.toString()));
else
template.print(gs.getMessage('in {0} days', days.toString()));
}
template.print('</font></p>');
})(current, template, email, email_action, event);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 11:18 AM
You will have to create email script to parse your integer value in string and then call this email script in your notification.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 12:00 PM
Dear Sachin,
PFB the all detail as I am doing the same but not getting where I am missing.
Notification Sample:
Email Script:
(function runMailScript(current, template, email, email_action, event) {
template.print('<p><font size="5" color="#808080" face="helvetica">');
template.print(gs.getMessage('Your incident has been resolved.'));
template.print('</font></p>');
template.print('<p><font size="4" color="#808080" face="helvetica">');
template.print(gs.getMessage('The incident will automatically close '));
var days = parseInt(gs.getProperty("glide.ui.autoclose.time"));
var hours = days * 24;
if (days == 0)
template.print(gs.getMessage('now'));
else if (days <= 3) {
if(hours == 1)
template.print(gs.getMessage('in {0} hour', hours));
else
template.print(gs.getMessage('in {0} hours', hours));
}
else {
if(days == 1)
template.print(gs.getMessage('in {0} day', days));
else
template.print(gs.getMessage('in {0} days', days));
}
template.print('</font></p>');
})(current, template, email, email_action, event);
Notification :
Regards,
Nandan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 11:39 AM
In your email notification you will have:
${mail_script:NameOfTheEmailScript}
===========================
In your email script:
template.print(parseInt(YourNumber));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 12:03 PM
Dear Nic,
Thank you for your support. I am here attaching the details please help me where do i change.
Notification Sample:
Email Script:
(function runMailScript(current, template, email, email_action, event) {
template.print('<p><font size="5" color="#808080" face="helvetica">');
template.print(gs.getMessage('Your incident has been resolved.'));
template.print('</font></p>');
template.print('<p><font size="4" color="#808080" face="helvetica">');
template.print(gs.getMessage('The incident will automatically close '));
var days = parseInt(gs.getProperty("glide.ui.autoclose.time"));
var hours = days * 24;
if (days == 0)
template.print(gs.getMessage('now'));
else if (days <= 3) {
if(hours == 1)
template.print(gs.getMessage('in {0} hour', hours));
else
template.print(gs.getMessage('in {0} hours', hours));
}
else {
if(days == 1)
template.print(gs.getMessage('in {0} day', days));
else
template.print(gs.getMessage('in {0} days', days));
}
template.print('</font></p>');
})(current, template, email, email_action, event);
Notification :
Regards,
Nandan