oncell client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2024 08:06 PM - edited ‎05-16-2024 08:09 PM
can someone tell me how can i restrict to one specific user the visibility of all class named Cloud Host in the configuration item list?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2024 08:09 PM
Hi @sola2 ,
Please refer to the solution : https://www.servicenow.com/community/developer-forum/how-to-restrict-a-role-group-to-view-certain-ci...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2024 08:57 PM
Hi @sola2,
You can try this via ACL.
Below is sample script
// Get the current user's sys_id
var userSysId = gs.getUserID();
// Replace with the sys_id of the specific user you want to allow
var allowedUserSysId = 'specific_user_sys_id';
// Get the CI class name
var ciClassName = current.sys_class_name;
// Allow access if the current user is the specific user and the CI is of class Cloud Host
if (userSysId == allowedUserSysId && ciClassName == 'Cloud Host') {
answer = true;
} else {
answer = false;
}
Regards,
Pratiksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2024 09:12 AM - edited ‎05-17-2024 11:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2024 11:51 AM
Which role? If you know which roles should not have access then we dont need the script.