Hide Related list using UI Policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 06:37 AM
Hi,
I have created a single related list and dragged above the page inside an annotation. But i can't hide and show the related list using g_form.hideRelatedList(); g_form.showRelatedList respectively in UI Policy /Client Script.
I have referred this doc, but can't able to find solution :
https://servicenowguru.com/client-scripts-scripting/hiding-related-lists-embedded-lists/
Based on the Type of Bill Entry Filed i need to show the related list below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 07:04 AM
I've used annotation to build this form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 07:14 AM
it's not a related list, you have added it as Embedded list on your form.
g_form.hideRelatedList() -> won't work on embedded list
2 ways to approach this
1) either use DOM manipulation and hide it, I won't recommend this as it's not best practice
How to hide an embedded list using a client script or UI Policy
OR
2) Add that embedded list on some form section and then hide that section
g_form.setSectionDisplay("embedded_listsection",false);
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
02-19-2025 07:34 AM
I've tried below method, but its not working
g_form.setSectionDisplay("embedded_listsection",false);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 06:58 PM
@NaveenB44866094 @Naveenbabu1531
Did you give correct section name? script or logic I shared should work fine
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
02-19-2025 08:46 PM
I've tired both the methods, but i can't able to hide the section.
This is the client script i have written