Inbound action for adding CC and BCC to watchlist no longer working?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 11:04 AM
I have been using this script for over a year and it has recently stopped working for adding people that were cced or bcced to the watchlist.
Here is my code:
var wList = current.watch_list;
var gList = current.u_group_watch_list;
var rarray = email.recipients_array;
var instanceEmail = gs.getProperty('glide.email.user');
//iterate through the recipient array
for(var i = 0; i < rarray.length; i++) {
var recipient = rarray[i];
var gr = new GlideRecord('sys_user');
gr.addQuery('email', recipient);
gr.query();
if(gr.next()) {
//it's a user
if(wList != "") {
wList = (wList + ',' + gr.sys_id);
} else {
wList = gr.sys_id;
}
} else {
if(recipient != instanceEmail) {
if(wList != "") {
wList = (wList + ',' + recipient);
} else {
wList = recipient;
}
}
}
}
current.update();
fairly straightforward, I am going through the email and iterating through the recipient array, checking this against the sys_user table and adds them(either by email or by sys_id).
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 11:26 AM
I found out what my problem was I needed this around my code
(function runAction(/*GlideRecord*/current, event, email, logger, classifier) {
})(current, event, email, logger, classifier);