controlling UI action visibility from related list changes

gourav_toonwal
Tera Contributor

Hey Community ,
I have a requirement to control the Visibility of a UI Action.
UI action : Revert to New.

Table : change_request

 

requirement : I need to hide the UI action "revert to new" on the table "change_request" when in the related list approvers any one of the approver approves . 

 

step to reproduce : 

1 create a normal change 

2. When record is in new state add a manual approver to the approver list.

3. complete any task (if any ) and move to assess state

4. button will be visible in form context menu.

Screenshot 2025-09-04 192921.png

 

the idea is when some approved the record there should be no chance to revert the the record and make the changes in record.
Any insight would be appreciated.

Thank you 

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@gourav_toonwal 

in the UI action condition you can call script include function

That script include function will check if this CHG is approved by 1 approver

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

if this will hide the button immediately or needs  a reload

because by default it is visible and in the assess state itself we need to approve the record . So it should hide immediately.

@gourav_toonwal 

UI action condition evaluates only once when form loads.

Button is on CHG table so when in related list somebody approves and if form doesn't reload then it won't work.

That's OOTB behavior.

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

Bhuvan
Tera Sage

@gourav_toonwal 

 

You can tweak the below script includes to match your conditions and use it in UI action

 

https://www.servicenow.com/community/developer-forum/show-ui-action-only-if-the-task-has-an-active-a...

 

If this helped to answer your query, please mark it helpful & accept the solution. 

 

Thanks,

Bhuvan