Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

How to restrict visibility of UI Action button on Change Req form?

Kiran_25
Tera Expert

Currently on the change request form there is Close UI action button is visible at the top of the page. I need to change this so that it is only visible when state = Implement OR Review. 

 

Below is UI Action condition which is not working:

 

gs.hasRole('itil,sn_change_write') && !new ChangeRequestStateHandler(current).isOnHold() && (new ChangeRequestStateHandler(current).isState("review") || new ChangeRequestStateHandler(current).isState("implement"))

6 REPLIES 6

Dr Atul G- LNG
Tera Patron

Hi @Kiran_25 

Could you please check how this works? Out of the box (OOTB), I believe a change can only be closed when it is implemented; otherwise, it can only be canceled. Because of this, your logic may conflict with the standard OOTB behavior.

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

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

I am working with Change Models and modifying it to fit business requirements. At the moment the Close UI button is visible at all states. If I remove ' !new ChangeRequestStateHandler(current).isOnHold() ' from the condition string then the button is no longer visible at any state. 

So you want to close the change event while it is On Hold? I am against that approach, mate. You are following a wrong practice. A change should only be clsoed outside Implemented state, either before or after. Could you share the full details or code so we can review it properly?

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

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

Dr Atul G- LNG
Tera Patron

Out of the box (OOTB), the Close UI action is not available in the Implemented state. Therefore, your logic will not work as expected.

 

DrAtulGLNG_0-1771496511150.png

 

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

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