- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 11:41 AM
Hi,
Some one help me , is my script line is correct or Not ?
when case created automatically sending one email to "Advin kumar "User, when "Advin kumar" used to send reply back & added some users in CC, BCC.
now i want to take only CC users from reply mail and add into Watch-list
add CC users into Watch-list
script: current.watch_list +=email.copied;
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 01:34 PM
var arr = [];
var id = email.copied.split(',');
gs.log(' id is '+ id.length);
for(var i = 0 ; i < id.length ; i ++){
var gr = new GlideRecord('sys_user');
gr.addQuery('email','IN',id[i]);
gr.query();
while(gr.next()){
arr.push(gr.sys_id.toString());
}
}
current.watch_list = current.watch_list +','+arr.toString();
Working Code.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 12:44 PM
var id = email.copied.split(',');
gs.log(' id is '+ id.length);
for(var i = 0 ; i < id.length ; i ++){
var gr = new GlideRecord('sys_user');
gr.addQuery('email','IN',id[i]);
gs.log('Row count is '+ gr.getRowCount());
gr.query();
while(gr.next()){
current.watch_list = gr.getUniqueValue()+'';
}
}
added another log and updated one line. try now.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 12:47 PM
updated script. this should work.
var arr = [];
var id = email.copied.split(',');
gs.log(' id is '+ id.length);
for(var i = 0 ; i < id.length ; i ++){
var gr = new GlideRecord('sys_user');
gr.addQuery('email','IN',id[i]);
gs.log('Row count is '+ gr.getRowCount());
gr.query();
while(gr.next()){
arr.push(gr.sys_id.toString());
}
}
current.watch_list = arr.toString();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 12:48 PM
try now this will work.
var arr = [];
var id = email.copied.split(',');
gs.log(' id is '+ id.length);
for(var i = 0 ; i < id.length ; i ++){
var gr = new GlideRecord('sys_user');
gr.addQuery('email','IN',id[i]);
gr.query();
while(gr.next()){
arr.push(gr.sys_id.toString());
}
}
current.watch_list = arr.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 12:49 PM
do you want may instance details ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 12:51 PM
the script which i added now, this will work. if it will not work. send me on my email.