How to hide fields only when list field value is exactly a option
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2023 11:24 PM
I have a requirement where i am having a List type field with Values A,B,C. I have to hide Date field when the list field is only B. When it is accompanied with A or C we should not hide date field. Can anyone help me on this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2023 11:27 PM
Hi,
Please provide more information/details on your issue.
What have you tried so far? What debugging have you tried?
Screen shots and such will also help in understanding your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2023 11:37 PM
should be an easy task.
what script you wrote? what debugging have you done so far if it didn't work fine?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2023 12:02 AM
I have tried with UI policy, but while giving the condition its showing CONTAINS . Bu what i need is IS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2023 12:32 AM
UI policy won't work
you need to use onChange client script
something like this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var arr = newValue.toString().split(',');
if(newValue == 'sysIdB' && arr.length == 1){
// hide the field
}
else{
// show the field
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader