- 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-24-2021 10:25 PM
Hi Ankur,
yes,
i will correct it.
thanks for your help.
but below code is not work. please check and get back me.
Thanks,
Tharun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2021 01:07 AM
Hi,
You cannot hide choice value from list
You can restrict the value using onCell Edit
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-22-2021 01:24 AM
Hi Ankur,
How we can write the code oncell edit.
Regards,
Tharun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2021 01:40 AM
Did you accidentally marked your own response as correct?
Would you mind marking my response as correct if I was able to help you
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-22-2021 01:41 AM
Hi,
I already shared the script above
Sharing again
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