Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action condition based on value on form

emyrold
Giga Expert

Is there any way to show/hide UI action conditionally based on client side selected choices?

I have a catalog item where I have a select box variable "Edit fields" with three choices and show 'none' is selected.

I would like to dynamically display the UI Action "Submit Edits" only if the user selects choice 1, 2 or 3 on the "Edit Fields" variable.   If the value is none then ui action is hidden.

This is client side and needs to be onChange()   so when the user selects a choice (record will not yet be saved) I want to then display the "Submit Edits" UI Action else it should be hidden.

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Erik,



Word of caution from the "old man". UI actions were not intended to be dynamically visible from a client script. Doing so carries risk of the script not working in future releases.



Reference: Technical Best Practices - ServiceNow Wiki


View solution in original post

5 REPLIES 5

emyrold
Giga Expert

Thanks everyone.... not sure what to do here in terms of marking correct answer.   Do I mark based on technical answer that works, or do I mark based off of best answer where I do not shoot myself in the foot?  



Thank you harshvardhansingh   for your solution!   It works.



However, based on ctomasi   advice, I will re-design my solution and remove the requirement of showing and hiding UI Actions dynamically - future proof myself as well as better support for mobile.



-e