Hide/Show field in related list based on the condition

Pragati Ajanalk
ServiceNow Employee
ServiceNow Employee

Hi,

 

I have a field let's say flag (True/False) and the related list "Order Task".
I want to hide the field "Priority" in the related list "Order Task" if the flag is False.

How this can be achieved?

4 REPLIES 4

Sai Kumar B
Mega Sage
Mega Sage

Hello @Pragati Ajanalk 

May I know the purpose of hiding/showing the field?
If you want to restrict users to not edit the priority field You can write a before-business rule on the related list table to abort the action on basis of the flag value.

Suma Mallidi
Tera Expert

Hi @Pragati Ajanalk ,

 

You can achieve this by creating 2 views one with a related list of priority in it and in another hide the priority from the related list. After that create a view rule based on your condition for showing and hiding the desired related list.

 

Please mark my reply as helpful, if it helps!

Jakob Anker
ServiceNow Employee
ServiceNow Employee

Joshua_Quinn
Kilo Guru

Set up a UI policy that checks if the current record has the 'flag' field as false. Then, in the Scripts tab of the UI Policy, enter

g_form.hideRelatedList(<enter the "REL:sys_id" value of the list here>);

in the "Execute if true" script box.