Cant hide a particular related list in workspace

Kumar38
Kilo Sage

I have to hide related lists to certain users. one of the related list is only visible on configure > related list, but not on form. Created a client script, it hid all the related lists on form , however it is not hiding the one that is not shown on form in Workspace.

 

This one is of relationship type and is added on selected realted lists but not visible on the form. However I can see the related list name (REL:xxxxxx) when printing logs in Client script. checked for any existing Client scripts , UI policies, Didn't find any.

 

g_form.hideRelatedLists(g_form.getRelatedListNames());

 

 

22 REPLIES 22

Ankur Bawiskar
Tera Patron
Tera Patron

@Kumar38 

is that a custom relationship added to workspace view on form?

If yes then right click the Related list header and Configure List Control and get the name of that and then use it to hide

g_form.hideRelatedList('REL:e1c005f91b0c2a508e08fc451a4bcbd2');

AnkurBawiskar_0-1742276562301.png

 

AnkurBawiskar_1-1742276587727.png

 

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

Yes, This id added to workspace view on form is a custom relationship visible in configure > relatedlists,(Right hand side). however its not visible on form. Which may be the reason why script is not hiding it?

Any idea why how relationships are hidden on related list without client script or UI policies.

@Kumar38 

I believe the checkbox Omit if empty is checked and hence if no rows in related list then it will be hidden OOB

If it's visible then the logic I shard above will hide it

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

"Omit if empty" is set to false, However I see a field only in list view called "Omit empty condition" that is set to true and is always being set to true even if i change it form list view.

 

Do you know if this is relevant ?