Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hide the "New" UI action button of the change_request from the related list of tasks.

Maria Sol Arauz
Tera Contributor

I need your help with a UI action on a related list of a change. I need to introduce the condition that the button disappears if the state of the change is implement, review, or scheduled. Can you help me?

3 ACCEPTED SOLUTIONS

Chaitanya ILCR
Mega Patron

Hi @Maria Sol Arauz ,

put this in the omit new script

 

var state = parent.state
if (state == -1 || state == -2 || state == 0)
    answer = true

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

@Maria Sol Arauz 

are you comparing correct state values?

also if you want to omit then ensure answer=true in script is set

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

Hi @Maria Sol Arauz,

 

Correct. This is why I reversed the logic us not equal to ("!=")

I'm glad you got to the solution.

 

This also works using inverse logic:

Screenshot 2025-04-09 at 15.37.39.png

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie

View solution in original post

9 REPLIES 9

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Maria Sol Arauz 

Go to the Change Task related list.

Right-click on any field.

Select List Control, and there you need to add the condition.

 

AGLearnNGrow_0-1744203582582.png

https://www.servicenow.com/community/developer-blog/how-to-hide-new-button-from-related-lists-using-...

*************************************************************************************************************
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]

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

Maria Sol Arauz
Tera Contributor

imagen.png

In the list control, I included the restrictions, but the button still appears in those states.

are you checking on new records?

*************************************************************************************************************
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]

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

@Maria Sol Arauz 

are you comparing correct state values?

also if you want to omit then ensure answer=true in script is set

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader