How to restrict a variable via ACL to a set of users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2023 06:57 AM
Hi,
I am having a requirement to restrict a variable 'Description' in a catalog item. This is available in all the catalog items in the system, it is in the variable set.
If someone selects the confidential checkbox on the RITM, then this variable has to be restricted only to a specific set of users(requested for, approver) and not to any other users
Please let know is there any approach to restrict the variable in ACL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2023 07:38 AM
HI Renu,
I guess you cannot restrict specific variable from ACL,
you can use g_scratchpad to check that specific uses based on your requirement. and then display that variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2023 08:03 AM
Hello @Renu9
You cannot use the ACL to restrict the variable. You can only restrict the records or fields on the table but not the variables.
If you want to restrict the variable on the form then you can use the Display BR as shown below:
g_scratchpad.show_description = "true";
if (current.confidential && (!gs.hasRoleExactly("your_role1_name_here") && !gs.hasRoleExactly("your_role2_name_here"))) {
g_scratchpad.show_description = "false";
}
then in onLoad catalog client script you can use the below:
function onLoad() {
if (g_scratchpad.show_description == "false") {
g_form.setDisplay("description", false);
} else {
g_form.setDisplay("description", true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2023 12:44 AM
Hi Mahendra,
I do not want that to be displayed even on the reports, so restricting only on the form is not sufficient.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2023 01:00 AM
Hi Renu,
check this article once may be this helpful
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0869438