What is the best way to send a notification when a Problem is created from an Incident server side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10 hours ago
"What is the best way to send a notification — including the Problem number and short description — when a Problem is created from an Incident, and should we use a Business Rule, Script Action, or Email Script for this, and in what order should each be executed?"
1. Business Rule (After Insert on Problem table)
(function executeRule(current, previous /*null when async*/) {
if (current.parent_incident) {
gs.eventQueue('custom.problem.created.from.incident', current, current.sys_id, current.parent_incident.sys_id);
}
})(current, previous);
2. Script Action (Triggered by Event)
var problem = current;
var incident = new GlideRecord('incident');
if (incident.get(event.parm2)) {
var email = new GlideEmailOutbound();
email.setSubject("New Problem Created from Incident: " + problem.number);
email.setBody("A Problem has been created.\n\nProblem: " + problem.number +
"\nShort Description: " + problem.short_description +
"\nRelated Incident: " + incident.number);
email.setRecipient(incident.caller_id.email);
email.send();
}
3. Email Notification