- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 08:35 AM
Hi all,
I'm trying to hide the related list 'vendor catalogue items' on the company table whenever the form is loaded, if the approval status field is set to none or approved, and the vendor field is ticked. I've attached a screenshot here showing these details, circling the two fields on the company form that should determine if the related list is visible or not, and also the related list I'm trying to hide. I've also attached a screenshot showing my catalogue UI policy I've created, that isn't working. I've tried what's in this article below, and no luck! Anyone got any ideas or had something similar?
Solved: How do I hide a related list on load? - ServiceNow Community
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 08:56 AM
Rather than using script you can utilize UI Policy Related List Action.
UI Policy
UI Policy Related List Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 09:16 AM
Hello LyndseySharpe,
As per your description "I'm trying to hide the related list 'vendor catalogue items' on the company table whenever the form is loaded, if the approval status field is set to none or approved, and the vendor field is ticked."
I believe you are trying to hide the related list when the conditions are met. However, in the script in "Execute if True" Part, you are doing showrelatedlist, instead of hideRelatedList.
Example:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 09:21 AM
Hi,
As per the say, your condition is "whenever the form is loaded, if the approval status field is set to none or approved, and the vendor field is ticked." But as per the screenshot, the approval status is "pending approval". So it's not hiding.
Solution: Please make the approval status none or approved and make Reverse if True as ticked. And for the scripting part as
Execute if true: g_form.hideRelatedList('pc_vendor_cat_item');
Execute if false as: g_form.showRelatedList('pc_vendor_cat_item');
Regards,
Srikanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 12:27 AM
Thank you everyone else 🙂 I actually wrote it incorrectly in my question 🙈 I meant to say I'm trying to hide the related list when the approval status is NOT approved or null. It was supposed to be visible for approved or null, so my script appeared correct. Not sure why it wasn't working but using the ui related lists tab worked 🙂