Cant hide a particular related list in workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 10:28 PM - edited 03-17-2025 11:15 PM
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());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 10:43 PM
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');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 11:04 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 11:21 PM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 11:35 PM
"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 ?