- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 09:01 AM
Hi,
someone help on incident script,
send incident details list to assigned to if incident state is OnHold on single notification .
ex: DavidLoo hasbeen assigned to 10-incidents , in 10-incidents there are 7 incidents have state -onhold. so DavidLoo should receive 7-incident details (number, shortdescription, caller , priority) in a single email.
i tried with below script, it is getting single incident details, how to get all in single email.
template.print("number :"+"${number}\n");
template.print("number :"+"${priority}\n");
template.print("number :"+"${caler_id}\n");
template.print("number :"+"${short_description}\n");
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 09:13 AM
Assuming that current contains all the incidents:
while(current.next()){
if(current.state =="Code"){
template.print("number :"+current.number);
template.print("Priorty :"+current.priorty);
template.print("CALLER ID :"+current.caller_id);
template.print("short desc:"+${short_description}");
template.print("\n");
}
}
Hope it works
Thanks
Sudhanshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 12:43 AM
i used below, but notworking
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
template.print("<table width=70% border=1><tr bgcolor=#e2e0de><td>Number</td><td>Priority</td><td>Caller ID</td><td>Short Desc</td></tr>");
var inc = new GlideRecord('incident');
inc.addQuery('assigned_to', current.assigned_to);
inc.query();
while (inc.next()) {
while (current.next()) {
if (current.state == "Code") {
template.print("number :" + current.number);
template.print("Priorty :" + current.priorty);
template.print("CALLER ID :" + current.caller_id);
template.print("\n");
}
}
}
template.print('</table>');
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 09:15 AM
Hi,
You can try using below mailscript.
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var getrec = new GlideRecord('incident');
getrec.addQuery('assigned_to', current.assigned_to);
getrec.addQuery('state','5');//replace 5 with correct on-hold state value
getrec.query();
while (getrec.next()) {
template.print("Number: " + current.number + "\n");
template.print("Priority: " + current.priority + "\n");
template.print("Caller ID: " + current.caller_id + "\n");
template.print("Short Desc: " + current.short_description + "\n");
template.print('-----------------------');
}
})(current, template, email, email_action, event);
Call the mail script in the notification body in form ${mail_script:abcdef}
Replace abcdef with mail script name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 10:00 AM