How to display choices for a field based upon if the current user is part of an assignment group in List view ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2022 08:01 AM
Trying to display choices for a particular field in List view if the current user is part of a specific assignment group. Created choices for the field through Dictionary entry and tried using a query BR to check of the user is part of the assignment group or not and then set the choices as inactive, however not able to update the fields. Any pointers will be helpful.
Script:
var rec = new GlideRecord('sys_choice');
var queryString = 'element=state^name=sc_task';
rec.addEncodedQuery(queryString);
rec.query();
while (rec.next()) {
if (gs.getUser().isMemberOf('Help Desk')) {
rec.inactive = false;
} else {
rec.inactive = true;
}
rec.update;
}
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2022 08:46 AM
You don't want to make choice records inactive, that will be doing it globally.
Way I think I would go is either using an ACL and restricting update permissions to the sc_task.state field or a business rule to reject the change if the user does not have the specified role or group membership (I'd lean towards using Role not Group).