How to hide/display field based on the user location in reference type variable in servicenow

Ashok
Tera Contributor

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.

1 REPLY 1

Community Alums
Not applicable

 @ 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.