How to hide/display field based on the user location in reference type variable in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 05:38 AM
How to hide/display field based on the user location in reference type variable in serviceNow
There was catalog item 'software' and there was one reference field 'select software' and this list have multiple options like 7Zip, Ablebits, Adobe...
My requirement was if user location is America then only 7zip values should be visible in 'select software' field, please suggest how to achieve this requirement.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 02:54 AM
@ Ashok
1) First Solution is create 3 different variables with software dependent choices and use ui policy to make visible based on software's.
2) You can create select box variable with select software name and add all choices, Then switch case logic to make choices visible based on selection of software
var software = g_form.getValue('variable name');
switch(variable name) {
case software1 :
g_form.addOption(values which needs to be displayed)
g_form.removeOption(values which needs to be hided) or use g_form.setDisplay(value,false);
}// similarly define for all the softwares.