how can we grant watchlist users on an HR Case the ability to see all HR Tasks linked to it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 06:37 AM
Hi team , i have a requirement to grant watchlist users on an HR Case the ability to see all HR Tasks linked to it
i tried with acl
but it is not working
but can someone assist me on this
(function() {
var userID = gs.getUserID();
// Get the parent HR Case record
var hrCase = new GlideRecord('sn_hr_core_case');
if (current.parent && hrCase.get(current.parent)) {
// Check if user is in the HR Case watchlist
var watchlist = hrCase.watch_list.toString().split(',');
if (watchlist.indexOf(userID) !== -1) {
return true; // Allow access
}
}
return false; // Deny access
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 06:43 AM
They will need to have the roles to see HR case tasks. Since tasks are usually meant to resolve the Case, tasks are only visible to fulfillers. But I can't look at your ACLs to see if anything is preventing them, nor have you shared what kind of users are on the watchlist of the case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 07:45 AM
I have Seen other ACLs out of box on the hr_task table, users without even the fulfiller role are able to see the task if they are added to the watchlist field.
We require the same functionality: if users are added to the watchlist on the HR Case, they should be able to see all HR Tasks linked to that case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 07:55 AM
Hello @DASAMANDAMS ,
Please create before query business rule on the HR Task table and write below script -
(function executeRule(current, previous /*null when async*/ ) {
if (gs.hasRole('admin') || gs.hasRole('sn_hr_core.admin')) {
return; // Allows users with these roles to view all HR Tasks without restriction.
} else {
// parent.watchlist is dynamic me
current.addEncodedQuery('parent.watch_listDYNAMIC90d1921e5f510100a9ad2572f2b477fe');
}
})(current, previous);