How to restrict a variable via ACL to a set of users

Renu9
Tera Contributor

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.

5 REPLIES 5

U_verma
Tera Expert

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.

Mahendra RC
Mega Sage

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);
}
}

 

Hi Mahendra,

I do not want that to be displayed even on the reports, so restricting only on the form is not sufficient.

 

Hi Renu,

 

check this article once may be this helpful

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0869438