Hide UI Actions when state is closed complete or closed incomplete

matthew_strecke
Kilo Contributor

I'm trying to hide two UI actions when the state is either closed complete or closed incomplete. If the state is either of these values I don't want the buttons to show up on the form. I added conditions to the UI actions but this will only hide the button if the form is in that state and not hide both buttons. Any suggestions? I've tried UI policies and client scripts but so far nothing is working properly.

1 ACCEPTED SOLUTION

Arindam Ghosh
Mega Guru

Hi Matt,



Your Condition should be like :



current.state!=<value for Closed Complete> && current.state!=<value for Closed Complete>



Please replace the values and use it in condition



Thanks,


Arindam


View solution in original post

5 REPLIES 5

Arindam Ghosh
Mega Guru

Hi Matt,



Your Condition should be like :



current.state!=<value for Closed Complete> && current.state!=<value for Closed Complete>



Please replace the values and use it in condition



Thanks,


Arindam


It should be:



current.state!=<value for Closed Complete> && current.state!=<value for Closed Incomplete>


manikorada
ServiceNow Employee
ServiceNow Employee

You can use client script to do this.



var items = $$('BUTTON').each(function(item){


    if(item.innerHTML.indexOf('Submit') > -1){ //Submit is the name of the UI Action


          item.hide();  


    }


});


Ashley
Kilo Sage

Can you paste what you have so far or tried?



The condition will look something like this on each UI action: (current.incident_state != 7 && current.incident_state != 6)



So if it's not one of these values (need to double check your state values) then show up.