- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â09-23-2020 05:17 AM
Hello,
I need to create an inbound action that auto populates the watch list with cc'd user(s) for RITMs. How can I do this? If a cc'd user does not exist in the system, I do not want to create a new user
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â09-23-2020 05:25 AM
Hi,
Within this inbound action, in the script section, you can retrieve the "copied" users (aka CC'd) which will give you a comma separated string of their email address. From there, you can query your sys_user table to find a match based off of this and if found, add them to your watch list.
Something like:
var copied = email.copied;
var watchList = current.watch_list;
var findMem = new GlideRecord('sys_user');
findMem.addQuery('email', 'IN', copied);
findMem.addQuery('sys_id', 'NOT IN', watchList);
findMem.query();
while (findMem.next()) {
current.watch_list += "," + findMem.sys_id;
}
current.update();
I just tested this myself and it does work. So as long as your inbound action has found the correct record to associate the email to, this will work just fine.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â09-23-2020 12:38 PM
can you check the logs and share the output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â09-23-2020 12:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â09-23-2020 12:53 PM
Yup that was the issue! I defined "arr" and it worked!
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â09-24-2020 12:06 PM
Hi,
If you check my code, i have made changes to the earlier code and it is nto the SAME code.
var ccUsers = email.copied;
ccUsers = ccUsers.toString().split(",");
var users = [];
for(i=0;i<ccUsers.length;i++) {
users.push(ccUsers[i]);
}
email.copied generally returns a string. So i converted that to array before querying sys_user table.
I thought this has actually fixed your issue as you already mentioned that the earlier code (without this fix) was not working. So give it a try, if that was the case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â09-23-2020 10:06 PM
Did you mistakenly mark other answer as correct? As I see same script was provided before from my end and
Please mark appropriate response as correct so that it would help future readers.
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader