Pulling SLA Due Dates for Email Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2023 04:42 PM - edited ‎07-26-2023 04:43 PM
Hi,
I'm creating some email notifications for Problem tickets, so Problem owners will get an email notification when assigned, and give them the SLA due date. Also another for when the SLA hots 50%, 75% and 100%.
In the 'Problem Assigned to' notification, I'm having some trouble pulling the SLA, when the Problem SLA has changed, such as a P1 Problem (30 day SLA), change to a P2 Problem (40 day SLA). The email, which is using the Problem [problem] table, is showing both SLA's rather than just the current SLA, (see below pic). How can I pull just the current/most recent SLA for each Problem?
My mail_script is:
{
var sla = new GlideRecord('task_sla');
sla.addQuery('task', current.sys_id);
sla.query();
while(sla.next()){
template.print(sla.planned_end_time + "<br>");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 12:09 AM
Hi @Ben28
"template.print" does not work inside the loop so, we need to store the value in variable. Please try below code.
{
var sla = new GlideRecord('task_sla');
sla.addQuery('task', current.sys_id);
sla.query();
while(sla.next()){
var getDueDate = sla.planned_end_time;
}
template.print(getDueDate+ "<br>");