How to hide a related list that is created through a relationship

Navyaa
Tera Expert

How to hide a related list that is created from a Relationship.

I have tried using the UI Policy,but no luck.

Please help.

1 ACCEPTED SOLUTION

Dhananjay Pawar
Kilo Sage

Hi,

Go through the below link,

https://www.servicenowguru.com/scripting/client-scripts-scripting/hiding-related-lists-embedded-lists/

 

Mark correct/helpful based on impact.

Thanks,

Dhananjay.

View solution in original post

4 REPLIES 4

Simon Westwood
ServiceNow Employee
ServiceNow Employee

Hi,

You need to use a client script to do this, specifically hideRelatedList 

Take a look at https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=r_GlideFormHideRelatedLists for the documentation.  Note that for a relationship you need to pass the sys_id of the relationship, not its name as you would for a table.

Kind regards,

Simon

 

 

Chavan AP
Tera Guru

Create UI Policy for the form with condition as field 'Action' is No.

 

 

 

To hide the related list Add the below code in the Execute if True script section.

 

g_form.hideRelatedList('related_list_table_name');

 

 

 

To show the related list Add the below code in the Execute if False script section.

 

g_form.showRelatedList('related_list_table_name');

 

 

 

Note: Get the related_list_table_name from thee list control of the related list. Right click related list header > Personalize/Configure List Control. Copy the value from the field 'Related list'

Glad I could help! If this solved your issue, please mark it as ✅ Helpful and ✅ Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****

Dhananjay Pawar
Kilo Sage

Hi,

Go through the below link,

https://www.servicenowguru.com/scripting/client-scripts-scripting/hiding-related-lists-embedded-lists/

 

Mark correct/helpful based on impact.

Thanks,

Dhananjay.

Daniel169
Kilo Contributor

To hide a related list that was created through a relationship use:

 

g_form.hideRelatedList('REL:<sys_id of the relationship>');

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0758509