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

SanjivMeher
Kilo Patron
Kilo Patron

If the script works, then the only change i would recommend is changing the client script to a OnChange Client script with field name as state, which will trigger the client script. onLoad client script only runs when the form load.


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

ritaaudi
Tera Contributor

Sorry I made it onload for easy testing. Script is not working: " $$ is not a function function () { [native code] }"

 

Looks like you can utilize a UI policy for this. Can you refer the solution in below thread.

https://www.servicenow.com/community/developer-forum/hide-button-with-onchange-client-script/m-p/155...

 


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

ritaaudi
Tera Contributor

I tried UI Policy too but it is also erroring on the $$

Thanks