Hide/Unhide UI action vis check box.

StuTheDev
Tera Contributor

I am looking to set my one of my UI actions so that it is only visible after a field on the incident form checked (set to true) 

 

The name of my field is called "test" (for now).  I attempted to add it to the conditions script but that does not seem to be the way to go. 

 

Thanks! 

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @StuTheDev 

 

https://www.servicenow.com/community/in-other-news/how-to-hide-show-an-ui-action-on-field-changes/ba....

 

A useful link. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Thanks for your response.  

In order to make my scenario the same as yours, in stead of a true/false check box, I created a choice field called CS with Yes/No as the choices.  

 

I tried the script you provided in the other thread and for some reason it disabled me from clicking the gray banner to access the form configuration options.  I tried the very last script in the thread and I am getting an error when I try selecting the options. 

StuTheDev_0-1706025508022.png

 

Here is the script I am currently using "THEBUTTON" is in place of the ui action button I am trying to show/hide

StuTheDev_1-1706025629455.png

 

function onCondition() {

    var buttons= document.getElementsByClassName('form_action_button action_context btn btn-default') ;
    for(var i=0;i<buttons.leingth;i++)
        {
            if(buttons[i].id=='THEBUTTON')
                {
                    buttons[i].hide();
                }
        }

StuTheDev_2-1706025724817.png