We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

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
Giga 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  ||  ✨ 10x 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

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-...

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

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

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?

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

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

@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  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader