Hide choice from List field type

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 11:12 AM
Hi Everyone,
I have list type of field which is not referring to any table but have certain choice. Refer below screenshot of dictionary of the field.
The requirement is to hide certain choice value dynamically based on some condition, like checkbox. If the checkbox field is true hide 3 choices out of 4 in the form.
I do not want to use any DOM manipulation. I also tried g_form.removeOption but it did not work on list type of field.
Any leads would be appreciated.
Regards,
Deepankar Mathur
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 11:37 AM
Hi Deepankar,
You can simply create a UI Policy and use the following condition:
If variable A = True then in the UI policy action select the choice name and make visible = false.
This should work.
Please mark this correct if answers your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 12:07 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 01:30 PM
I know you don't want to but I'm reasonably sure you are going to have to use DOM manipulation to add and remove values you do not want people picking because its a list.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 06:59 AM
Hey Drew,
We do not want to any DOM manipulation as it is not a best practice nor recommended by Servicenow
Thanks
Deepankar Mathur