Adding users to watchlist on sc_task and inc table through task table

Kishan_
Tera Contributor

Hey folks,

 

I've been trying to add users to the watchlist on Inc and sc_task form based on the assignment group, but it either works on INC table or none. tried adding using task table but didn't seem to help. Tried a couple of ways through after business rule.

Any suggestion on how to got about?

 

Thanks

4 REPLIES 4

Riya Verma
Kilo Sage
Kilo Sage

Hi @Kishan_ ,

 

Hope you are doing great.

 

  1. Create an "After Business Rule" on both the Incident (INC) and Task (sc_task) tables.
  2. Implement the business rule script referencing below script:

 

(function executeRule(current, previous) {
    if (current.assignment_group) {
        var assignmentGroup = current.assignment_group;

        var userGr = new GlideRecord('sys_user');
        userGr.addQuery('assignment_group', assignmentGroup);
        userGr.query();

        while (userGr.next()) {
            current.watch_list.add(userGr.getValue('sys_id'));
        }
    }
})(current, previous);

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Hi Riya, 

Sorry for the late reply.

It is working but I would like to have inly a specific set of users added to the watchlist. These users may or may not be part of the same assignment group.

Ankur Bawiskar
Tera Patron
Tera Patron

@Kishan_ 

please share your script and if you are using BR then share BR configuration screenshots as well.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur, 

Will update the BR and try. Then will share the details. 

Thanks