- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2021 07:56 PM
Hi All,
how we can restrict dropdown values in the list view
Table: Incident
Field: State
Field value ‘Closed’ should be visible only for Admin user in both form view and list view (In form view, this is already in place, need to do it in list view as well).
Regards,
Tharun
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2021 10:30 PM
Hi,
So only admins should be able to change State to closed
update BR condition as this
current.state == 7 && !gs.hasRole('admin')
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2021 08:12 PM
You can't remove the option from the list view, unfortunately.
Your best bet would be to create an ACL to prevent editing the state field from the list. This post gives you the idea, you'd just need to set it for that single field instead of the whole table.
Otherwise you could create a before business rule on update to check the roles of the user and the state being set and abort the update with a message.
Those are the options I've had the most success with.
I hope this helps!
If this was helpful or correct, please be kind and remember to click appropriately!
Michael Jones - Proud member of the CloudPires team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2021 09:39 PM
Hi Michael,
I need to restrict the STATE Field value ‘Closed’ should be visible only for Admin user.
Please provide the septs.
Regards,
Tharun k
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2021 09:52 PM
Hi,
You can use onCell Edit and check if the value is closed and if user is not admin then stop the saving
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2021 09:58 PM
onCell Edit Client Script example
Table - your table
Field - State
Script:
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
//Type appropriate comment here, and begin script below
var isAdmin = g_user.hasRole('admin');
if (!isAdmin && newValue == '3'){
alert('Not allowed to set this state');
saveAndClose = false;
}
callback(saveAndClose);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader