How do I add two users to RITM Watch List through a Workflow script?

bananaslug3865
Tera Contributor

Hi!

I am working on a script that will add two users to the request watch list after a customer submits a form. One of them is a variable on the form. The other is a user.

I chose the "Run Script" activity in the workflow editor to accomplish this. When I test it, the last line is the only value that is set. My guess is that it overrides the first line of code.

//Add Approval Manager to Watch List
current.watch_list = current.variables.purchase_rqst_approval_mngr_name;

//Add User to the Watch List
current.watch_list = 'sys_id';

So how do I add both users in the workflow?

Thanks!

Cecilia

1 ACCEPTED SOLUTION

Nitesh Balusu
Giga Guru

You have to add them as coma separated. 

 

current.watch_list = 'sys_id'+ ',' + current.variables.purchase_rqst_approval_mngr_name;

View solution in original post

4 REPLIES 4

Nitesh Balusu
Giga Guru

You have to add them as coma separated. 

 

current.watch_list = 'sys_id'+ ',' + current.variables.purchase_rqst_approval_mngr_name;

make sure you try them separately first and see if current.watch_list='sys_id'; is working.

That did the trick. Thank you!

jeremymatthew
Tera Expert

I've been trying this but unable to do so. I'm trying to add users to the Incident record Watch List from default SLA Workflow and I'm using current.task.watch_list = current.task.assigned_to.manager.name any advice if I'm doing this correctly is appreciated. Thanks.