- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 10:20 AM
Hi,
How to hide a choice value (Linux) on the list view for a user with non admin access ?
On form I used client script onLoad but it's not working on onCellEdit.
var adminUser= g_user.hasRole('admin');
if (!adminUser){
g_form.removeOption('operation_system', 'Linux');
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 10:58 AM
Hi kris,
Create OnCellEdit Client Script:
select field - operation_system
script:
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
//In Place of "10" add your Linux value
if ((newValue == '10') && (g_user.hasRole('admin'))) {
saveAndClose = true;
} else {
alert('Only admin can select this choice');
saveAndClose = false;
}
callback(saveAndClose);
}
If my above response is helpful, then Please mark as Correct Answer/Helpful.
Please check and let us know.
Thanks 🙂
Shakeel Shaik 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 10:29 AM
Check out the docs here
https://docs.servicenow.com/bundle/paris-application-development/page/script/client-scripts/concept/client-scripts.html
Basically, if memory serves its not possible, you have to use an onCellEdit client script validate that they are allowed to pick it or not and if not don't do the update.
If only an admin can use it you may want to consider a UI action that an admin can use to set the value for the field to "Linux" and then just remove it from the dropdown.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 10:44 AM
Hi Kris,
Check this link https://community.servicenow.com/community?id=community_question&sys_id=b8d08f65db98dbc01dcaf3231f96194c
Regards,
Bala T
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 10:52 AM
I need to hide/restrict choice value on lit view, not form view

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 10:53 AM
If you look thru that one you will find a link to this
https://community.servicenow.com/community?id=community_question&sys_id=5f55c7addbd8dbc01dcaf3231f96193f
which uses an ACL which should work for your case.