Employees in watch list are not able to see the requests for which they are marked in watch list

rajasekharteja
Tera Guru

Hi Team,

 

I have a requirement that Employees in watch list are not able to see the requests for which they are marked in watch list under my requests of self-service portal and also send email to watch list users

 

I have tried creating after business rule on sc_req_item table

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var users = current.variables.watch_list;
    gs.addInfoMessage('wl users ' + users);
    if (users) {
        gs.addInfoMessage(' users ' + users);
        var requestGR = new GlideRecord('sc_request');
        if (requestGR.get(current.request)) {
            requestGR.watch_list = users;
            requestGR.update();
            gs.addInfoMessage('watch list ' + requestGR.watch_list);
        }
    }

})(current, previous);
 

Watch list field is not present on the request table so i  have created on sc_req_item table.

 

Please check and help to achieve this scenario.

 

Thanks,

Raja

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@rajasekharteja 

you can configure the My Requests filter from left navigation

For that you need to do this

1) populate watch_list field on REQ table from the catalog item variables- this you are already doing, ensure this works fine. Business rule should be after insert on RITM table

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var users = current.variables.watch_list; // I hope this is a list collector variable pointing to sys_user
    gs.addInfoMessage('wl users ' + users);
    if (users) {
        gs.addInfoMessage(' users ' + users);
        var requestGR = new GlideRecord('sc_request');
        if (requestGR.get(current.request)) {
            requestGR.watch_list = users.toString();
            requestGR.update();
            gs.addInfoMessage('watch list ' + requestGR.watch_list);
        }
    }

})(current, previous);

2) Update this my request filter record to include watch list in condition, use OR condition and add watch list [is dynamic] Me

AnkurBawiskar_0-1747806178656.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

View solution in original post

3 REPLIES 3

abbasshaik4
Tera Sage

Hello @rajasekharteja,

 

For a similar kind of issue, please refer to the below link:
https://www.servicenow.com/community/hrsd-forum/how-the-watchlist-person-can-able-to-see-my-requests...

 

If it is helpful, please hit the thumbs up button and accept the correct solution by referring to this solution it will helpful to them.

Thanks & Regards,

Abbas Shaik

Ankur Bawiskar
Tera Patron

@rajasekharteja 

you can configure the My Requests filter from left navigation

For that you need to do this

1) populate watch_list field on REQ table from the catalog item variables- this you are already doing, ensure this works fine. Business rule should be after insert on RITM table

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var users = current.variables.watch_list; // I hope this is a list collector variable pointing to sys_user
    gs.addInfoMessage('wl users ' + users);
    if (users) {
        gs.addInfoMessage(' users ' + users);
        var requestGR = new GlideRecord('sc_request');
        if (requestGR.get(current.request)) {
            requestGR.watch_list = users.toString();
            requestGR.update();
            gs.addInfoMessage('watch list ' + requestGR.watch_list);
        }
    }

})(current, previous);

2) Update this my request filter record to include watch list in condition, use OR condition and add watch list [is dynamic] Me

AnkurBawiskar_0-1747806178656.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

@rajasekharteja 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.