
Jon Ulrich
Kilo Guru
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-21-2020 11:46 AM
Implement this after Update business rule on your Email Script [sys_script_email] table to update any references to your email notification script when the name is changed
var notifications = new GlideRecord('sysevent_email_action');
notifications.addEncodedQuery('message_htmlLIKE${mail_script:' + previous.name);
notifications.query();
var count=0;
while (notifications.next()) {
var body = notifications.message_html;
reg = new RegExp('\\$\\{mail_script:' + previous.name + '\\}', 'gmi');
body = body.replace(reg, '${mail_script:' + current.name + '}');
notifications.message_html = body;
if(notifications.update())
count++;
}
gs.addInfoMessage(count +" notifications updated with new email script reference");
Labels: