The CreatorCon Call for Content is officially open! Get started here.

Automattically add Certain users to RTASK watch list

GeoV
Tera Expert

We are sending e-mail to ServiceNow and it automatically creates a TASK

 

we want  Certain users to be automatically added  as watchlist members  to that TASK  

 

Have the following script

if (email.body.CAIRCA == "CAIRCA")
var wlist = email.body.wtlist;
current.watch_list = wlist;
current.update();

 

e-mail body will be as follows

 

CAIRCA:CAIRCA

wtlist:xyz1@exmplae.com;xyz2@example.com

 

My task is getting created, assigned to  correct group as we have the following field also (as below)  in the e-mail, but the Watch List is still empty. xyz1 and xyz2 are just to show, but  we are e-mail of correct users in the system

 

Group: SNow-Business Applications & Integrations

 

Thanks for your feedback

 

1 REPLY 1

GeoV
Tera Expert

so I modified my script as follows

 

//var wlist = email.body.wtlist;
var task = new GlideRecord('sc_task'); // Change 'incident' to the dev task table
if (task.get(current.sc_task.sys_id)) {
   task.watch_list = 'xyx@abc.com'; // xyz@abc.com - valid user
   //task.update();
}
sc_task > table for TASK
current > the context of creating a record in sc_task table
 
it still does add e-mail  into watch_list
 
- should it be
task.watch_list = task.watch_list + 'xyx@abc.com';