- 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 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:02 AM
As far as the script approach is related, your scripts would look like below.
Execute if true will contain below script.
function onCondition() {
g_form.hideRelatedList('pc_vendor_cat_item');
}
Execute if false will contain below script.
function onCondition() {
g_form.showRelatedList('pc_vendor_cat_item');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 09:09 AM
In case if you just want to hide that related list only on load of the form when conditions are met, then you can utilize below script.
function onLoad() {
//Type appropriate comment here, and begin script below
var vend = g_form.getValue('vendor');
var app_status = g_form.getValue('backend_name_of_approval_status_field');
if (vend == 'true' && (app_status == '' || app_status == 'backend_value_of_choice_approved')) {
g_form.hideRelatedList('pc_vendor_cat_item');
} else {
g_form.showRelatedList('pc_vendor_cat_item');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 12:26 AM
Thanks so much, this worked! I can't believe I missed that extra tab, I use the first tab 'ui policy actions' all the time 🙈