- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2021 10:28 AM
Hello everyone,
I'm a newbie to the ServiceNow platform and have a quick question I need help with.
As the title says, I'd like to make certain fields on a catalog item visible only to specific user roles (ex. itil users) but not the rest of the users.
Can someone help me out?
Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2021 11:45 PM
Hello
You need to write one onLoad Catalog Client Script in Your Catalog Item.
First Type sc_cat_item.LIST in Application Navigator. your maintain item table will open in new tab.
open your catalog item in new tab by hold ctrl button and click on it.
Now in the bottom.
now here you have 2 concerns that you need to check?
1) is your variable is in Variable Set?
2) is your variable is available normally in Variable section i.e item_option_new table. like below.
first see case 2:-
then you need to write onLoad Catalog Client Script 4th section of above image. Catalog Client Script.
click on new
write below script as given,
Case 1:- if your variables are inside the Variable set then you need to perform this same in variable set.:-
Go to 2nd tab of variable set.
Select your variable set and open it. then follow same procedure only difference is you need to add your Variable Set name there.
Please Refer my Article on Role Selection. follow the client side user role section from my Article.
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2021 11:24 AM
Hi,
You can do this with Catalog UI Policies. You can find out more about this here:
Just use this in the UI Policy script which you can find under the Script Tab. Check the 'Run Scripts' field (i.e. make it true) and in the 'Execute if true' field use the following script:
if (g_user.hasRole('rolename'))
g_form.setDisplay('variable name',true);
else
g_form.setDisplay('variable name',false);
}
where rolename is the name of the role you want to check e.g. itil and variable name is the name of the variable you want to hide. In this example you can just use the 'Execute if false' field as is as everything is taken care of in the 'Execute if true' script.
The other thing to be aware of is any potential conflict with Client Scripts which can also be used to set visibility using basically the same code. UI Policies run AFTER Client Scripts and will override any visibility settings done by them. For that reason alone I tend to do all visibility, mandatory, read-only, and clear field requirements in UI Policies rather than Client Scripts.
Please mark as correct/helpful if this helps you
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 11:50 AM
Is it possible to expand this type of Catalog UI Policy to also require that field be populated, but only when they have a certain role/are in a certain assignment group?
The solution I am trying to deliver is a required select box in the portal that asks if the request is being summited due to a walkthrough performed by our facilities unit when the user filling out the form belongs to the facilities assignment group. They don't want to require this for users outside of their assignment group or non ITIL users.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2021 11:27 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2021 11:45 PM
Hello
You need to write one onLoad Catalog Client Script in Your Catalog Item.
First Type sc_cat_item.LIST in Application Navigator. your maintain item table will open in new tab.
open your catalog item in new tab by hold ctrl button and click on it.
Now in the bottom.
now here you have 2 concerns that you need to check?
1) is your variable is in Variable Set?
2) is your variable is available normally in Variable section i.e item_option_new table. like below.
first see case 2:-
then you need to write onLoad Catalog Client Script 4th section of above image. Catalog Client Script.
click on new
write below script as given,
Case 1:- if your variables are inside the Variable set then you need to perform this same in variable set.:-
Go to 2nd tab of variable set.
Select your variable set and open it. then follow same procedure only difference is you need to add your Variable Set name there.
Please Refer my Article on Role Selection. follow the client side user role section from my Article.
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat