Make Case watchlist into email CC using Email script. how we can approach?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I want to make cc watchlist into email CC. How we can achieve using email script?
10 REPLIES 10
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Can you try with this code snippet:
if (!current.watch_list.nil()) {
var watchSysIds = current.watch_list.split(",");
var len = watchSysIds.length;
for(var i = 0; i!=len; i++)
{
if(watchSysIds[i].toString().indexOf("@") > -1)
{
email.addAddress("cc", watchSysIds[i], watchSysIds[i]);
}else
{
var notifyUsr = new GlideRecord("sys_user");
notifyUsr.addQuery("sys_id", watcherIds[i]);
notifyUsr.addQuery("notification", 2);
notifyUsr.addQuery("email", "!=", "");
notifyUsr.query();
while (notifyUsr.next())
{
email.addAddress("cc", notifyUsr.email, notifyUsr.getDisplayValue());
}
}
}
}
