- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 12:09 PM
Hi,
if a Problem Task is assigned to my group, I would like the system to send all group members an email notification.
I created a notification below,
Reported by: ${sys_created_by}
Number: ${number}
Assignment group: ${assignment_group}
Assigned to: ${assigned_to}
Priority: ${priority}
Short Description
Created Date(Don't include time): ${mail_script:date_without_time}
Not able to find a field for short description and created date without time. Can anyone help to solve this?
Preview mail:
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 02:04 PM
Hi @JulietD,
There is a field called short_description on the Problem Task record which you can use.
And, you can use the following email script to get the created date without time.
Name: date_without_time
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var gdt = new GlideDateTime(current.getValue('sys_created_on'));
var date = gdt.getDate();
template.print(date);
})(current, template, email, email_action, event);
Email notification:
Reported by: ${sys_created_by}
Number: ${number}
Assignment group: ${assignment_group}
Assigned to: ${assigned_to}
Priority: ${priority}
Short Description: ${short_description}
Created Date(Don't include time): ${mail_script:date_without_time}
Outcome:
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 07:08 PM
Hi @JulietD ,
You can create a 'notification email script' and call it in the notification body with the below syntax:
${mail_script:notificationEmailScriptName}
Navigate to table [sys_script_email] and create new record with below details:
Name - problem_info
Script -
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
template.print("<p>Hi, ");
template.print("<p>Reported By: "+ current.sys_created_by);
template.print("<p>Number: "+ current.number);
template.print("Assignment group: "+ current.assignment_group.getDisplayValue());
template.print("Assigned to: "+ current.assigned_to.name);
template.print("Priority: "+ current.priority.getDisplayValue());
template.print("Short Description: "+ current.short_description);
var gdOpenedDate = new GlidedateTime(current.sys_created_on);
var dateVal = gdOpenedDate.getDate();
template.print("Opened Date: "+ dateVal);
})(current, template, email, email_action, event);
In the email notification: Remove the content and add the below :
${mail_script:problem_info}
This will give you flexibility to amend the content of notification in future.
Please mark this response as correct or helpful if it assisted you with your question.
Mark this as Helpful / Accept the Solution if this helps.