- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2025 11:13 PM
Dear experts,
I am facing a problem where I am stuck in how to make certain related list tabs show when a certain field in the risk event form is selected then prompting the specific related list tabs to appear instead of all the tabs that is unrelated to appear simultaneously after submitting the risk event form. For example, I have created two custom tables one is payment-related fraud table, and another one is cyber incident table. In the risk event form, there is a field called risk event type so when I select payment-related fraud, then after submitting the payment-related fraud table will populate out and the cyber incident table will not, vice-versa.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 12:44 AM
I assume you are using correct value to compare and given correct name of the related list
try this
function onLoad() {
if (g_form.getValue('u_risk_event_type').toString() != '5') {
alert('inside');
g_form.hideRelatedList('sn_risk_advanced_payment_fraud_related_risk', true);
}
}
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-23-2025 11:22 PM - edited 02-24-2025 12:44 AM
you can use onload or onChange and based on field type show/hide the related list
if (g_form.getValue('risk_type') == 'your type value') {
g_form.hideRelatedList('related_list_table_name', true);
}
If you have created a defined relationship then follow these steps
- Go to any form where the related list is present.
- Right-click to open the column context menu on the related list.
- Select Configure > List control.
- the ‘Related list’ field value from the list control. (Suppose - "Related_list_value" is the value)
- Now the statement should be g_form.showRelatedList('Related_list_value');
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-24-2025 12:07 AM
It does not work as it appears to. This is my script. Please help.
function onLoad() {
if (g_form.getValue('u_risk_event_type').toString() !== '5') {
g_form.hideRelatedList('sn_risk_advanced_payment_fraud_related_risk');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 12:44 AM
I assume you are using correct value to compare and given correct name of the related list
try this
function onLoad() {
if (g_form.getValue('u_risk_event_type').toString() != '5') {
alert('inside');
g_form.hideRelatedList('sn_risk_advanced_payment_fraud_related_risk', true);
}
}
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-23-2025 11:24 PM
Hi @ChuanYanF
You can create one On Load Client Script and use g_form.hideRelatedList API to hide the one of the related list depending upon the value of a field in the risk event field.
If my response helped, please mark it correct and close the thread so that it benefits future readers.
Regards,
Rohit