SCTASKs to be visible only to IT Onboarding teams
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 06:46 AM
Hi All,
I am trying to ristric the SCTASKs to be visible only to IT Onboarding teams.
The sctask created from one purticular item , it should be visible only for HR onboard team.
please help someone to achieve this.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2024 03:53 PM
Hello @Barathk
You can achieve this by writing the read ACL on the specific catalog item on sc_task table.
Use the below script to be visible only to particular groups you want to show:
var answer = gs.getUser().isMemberOf("Group name or sys_id");
Hope it helps
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 10:53 AM
Hi Murthy,
Thanks for the update.
I am trying to use this script in ACL , but this script is not working , can you please help me if changes requesd.
// Get the catalog item sys_id for the SCTask
var catalogItemSysId = current.cat_item;
// Define the sys_id of the specific catalog item you want to restrict
var hrCatalogItemSysId = '3D039c516234b6a3549dbe5dfc';
// Define an array of HR group sys_ids
var hrGroupSysIds = [
'477a05d15301306ddeeff7b1225', // HR1 sys_id
'287ee6fea9fefdada7950d0b1b73', // HR2 sys_id
// Add more group sys_ids as needed
];
// Check if the SCTask is associated with the specific catalog item
if (catalogItemSysId == hrCatalogItemSysId) {
// Initialize the answer as false
var answer = false;
// Check if the current user is in any of the HR groups
for (var i = 0; i < hrGroupSysIds.length; i++) {
if (gs.getUser().isMemberOf(hrGroupSysIds[i])) {
answer = true;
break; // Exit the loop if the user is found in any HR group
}
}
// If the user is not in any HR group, answer remains false
} else {
// If not the specific catalog item, allow access
answer = true;
}