- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 01:44 AM
Add one user to watchlist of Request and it should reflect on watchlist of RITM, SCTASK. can anyone help me on this how to achieve it.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2022 03:56 AM
Change the business rule as below
After - Insert and Update
condition - Watchlist in Not Empty

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 02:00 AM
Hi,
Write an after business rule on sc_request table
(function executeRule(current, previous /*null when async*/) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request',current.sys_id);
ritm.query();
while(ritm.next())
{
var sc = new GlideRecord('sc_task');
sc.addQuery('request_item',ritm.sys_id);
sc.query();
while(sc.next())
{
sc.watch_list = current.watch_list;
sc.update();
}
ritm.watch_list = current.watch_list;
ritm.update();
}
})(current, previous);
Mark as correct or helpful if it works.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 02:28 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 04:38 AM
It will still work even if watchlist users are added automatically unless if the users are added using any script that uses "setWorkflow(false)".
If that is the case then write an onLoad client script on RITM and sc task tables and make an ajax call to a script include and set the watchlist.
Mark as correct or helpful if it works.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2022 03:56 AM
Change the business rule as below
After - Insert and Update
condition - Watchlist in Not Empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 02:13 AM
We can achieve it by writtting the After Business rule on sc_request table defining the filter condition as whenever Watchlist changes.
(function executeRule(current, previous /*null when async*/) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request',current.sys_id);
ritm.query();
while(ritm.next())
{
var sc = new GlideRecord('sc_task');
sc.addQuery('request_item',ritm.sys_id);
sc.query();
while(sc.next())
{
sc.watch_list = current.watch_list;
sc.update();
}
ritm.watch_list = current.watch_list;
ritm.update();
}
})(current, previous);