hideRelatedList should I use "REL:[sys_id]" or name as the argument and does order of hiding matter?

Brian Whyte
Kilo Guru

So, I found some guidance out there indicating this was the proper syntax for hiding a related list.

 

//Hide Related Lists that we don't need
g_form.hideRelatedList("REL:48d5301981cf21101304af564a4f7043");
g_form.hideRelatedList("REL:48d5301981cf21101304af564a4f7055");

 

After running the above nothing was hidden. So, I did this instead and it worked:

 

//Hide Related lists that we don't need
g_form.hideRelatedList("change_request.parent");
g_form.hideRelatedList("change_task.parent");

 

One very important thing I also learned in playing with this is if you hide multiple related lists, it seems you must order them as they appear left to right in the tabs or else the first one will hide and the ones after that  don't won't hide. So, in the example above, if I ordered these two lines differently one would hide and the other wouldn't.

 

Hopefully, this ordering and using the name instead of the REL:sys_id helps someone else.

1 REPLY 1

Hemanth M1
Giga Sage
Giga Sage

Hi @Brian Whyte ,

 

1)If a related list created through relationship 

use g_form.hideRelatedList("REL:48d5301981cf21101304af564a4f7043");

 

2)If its a related list 

use g_form.hideRelatedList("name of the related list");

 

HemanthM1_0-1700627469694.png

Related list:

HemanthM1_1-1700627578918.png

 

Relationships:

HemanthM1_2-1700627617895.png

 

 

Sometime both wouldn't work since name of the related list has been changed through list control

use:g_form.hideRelatedList("name of the list control");

HemanthM1_3-1700627740335.png

 

HemanthM1_4-1700627763990.png

 

And Oder doesn't matter here........

 

Hope this helps

 

 

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025