How to hide Select Box choices based on User Criteria

Donald Small1
Tera Expert

I have a catalog item that is used for different offices.  One of the variables is a Select Box.  I need to have different Question Choices depending on the location of the user.  I have setup user criteria for each location.  How can can I hide/show question choices based on user criteria?  Catalog UI Policies don't seem to have the option.

1 ACCEPTED SOLUTION

Prateek kumar
Mega Sage

You would need to have a GlideAjax and Onchange client script to get the location and show/hide the choice values.

https://www.servicenowguru.com/scripting/user-object-cheat-sheet/

http://servicenowmypath.blogspot.com/2017/10/glideajax-example-servicenow.html

https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=r_GlideformAddOption_String_String_St...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

View solution in original post

2 REPLIES 2

Alok Das
Tera Guru

Hi Donald,

You could achieve this via onLoad Client Script, use the glideajax functionality to call the scriptinclude to validate the user criteria and handle the choices in client script with the functions:

g_form.addOption()
g_form.removeOption()

Kindly mark my answer as Correct and Helpful based on the Impact.

Regards,

Alok

Prateek kumar
Mega Sage

You would need to have a GlideAjax and Onchange client script to get the location and show/hide the choice values.

https://www.servicenowguru.com/scripting/user-object-cheat-sheet/

http://servicenowmypath.blogspot.com/2017/10/glideajax-example-servicenow.html

https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=r_GlideformAddOption_String_String_St...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks