How to hide button button on state change

ritaaudi
Tera Contributor

Hi: I want to be able to hide the Close Complete button on the RITM form when the state changes to Closed incomplete. I tried this but it didn't work:

ritaaudi_0-1712088041723.png

I don't get the alert 2 popup. Any idea? Thank you!

1 ACCEPTED SOLUTION

@ritaaudi If you dont mind, can you mark my response as correct where I suggested to create the UI action.


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

21 REPLIES 21

The reason could be because it is scoped application. The solution provided here may work for you

https://www.servicenow.com/community/developer-forum/quot-typeerror-is-not-a-function-quot-which-fun...

 


Please mark this response as correct or helpful if it assisted you with your question.

SanjivMeher,  The glide.script.block.client.globals property did the trick, but wondering what impact that will have on other  processes. Any idea? Thank you!

This article should explain

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0551586

 

Since this is just a small feature, I wouldn't compromise with this property. Instead, I would add a condition in the UI action to now allow to use Close Complete when state is manually changed to Closed Incomplete. You can try adding a condition in the UI action or add a script to move to Closed Complete only if current.state is not Closed Incomplete.


Please mark this response as correct or helpful if it assisted you with your question.

Hi SanjivMeher , I'd like to use the UI action condition but when I add:
current.state != 4

to the condition, it hides it after the update not after I select it from the drop down. 

But when clicked, it shouldn't allow to use that button I guess...Thats the solution I could think of..

The other options would be disable state changes via form, which I usually do. And provide them buttons to move to next state. So may be create another button Closed Incomplete and make the state read only.


Please mark this response as correct or helpful if it assisted you with your question.