- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2020 07:07 AM
How to hide a Related Tab and sections from the RITM form using a UI Policy script.
when a particular catalog item is used, the the RITM generated should hide few of the fields, sections and related list and tabs on the form.
I have written the code like below in UI Policy Run script
function onCondition() {
g_form.setDisplay('request', false);
g_form.setDisplay('location', false);
g_form.setDisplay('cmdb_ci', false);
g_form.setDisplay('priority', false);
g_form.setDisplay('u_ritm_category', false);
g_form.hideRelatedList('u_vendor_id_reference', true);
//g_form.setDisplay('u_vendor_id_reference', false);
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2020 08:01 AM
the correct syntax to hide/show section and related list is below
g_form.setSectionDisplay('schedule', false); // name of section
g_form.showRelatedList('task_ci'); // name of related list
g_form.hideRelatedList('task_ci'); // name of related list
check below links for help
Show/Hide Form Section by Name
Hiding Related Lists and Embedded Lists
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 02:27 AM
Please try to login now, it will work . The account was locked earlier.
How is it working for Affected CI and approvals now?
what did you do to fix the issue?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 01:56 AM
How is it working for Affected CI and approvals now?
what did you do to fix the issue?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 02:18 AM
Hi,
there was error in this line; so it was breaking and not executing next lines
g_from.hideReleatedList('sc_req_item'); // it should be g_form
g_form.hideRelatedList('task_sla');
g_form.hideRelatedList('task_ci');
g_form.hideRelatedList('sysapproval_approver');
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 02:43 AM
It does not work on my main instance:(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 02:56 AM
Below is my code :
if (g_form.getValue('cat_item') == 'sys_id')
{
g_form.setDisplay('request', false);
//g_form.setDisplay('location', false);
g_form.setDisplay('cmdb_ci', false);
//g_form.setDisplay('priority', false);
//g_form.setDisplay('u_ritm_category', false);
g_form.setDisplay('u_created_by_servicedesk', false);
g_form.setDisplay('u_left_from_servicedesk', false);
g_form.setDisplay('u_request_type', false);
g_form.setDisplay('opened_by',false);
g_form.setDisplay('u_owner', false);
g_form.setDisplay('u_business_process', false);
g_form.setDisplay('u_delivery_approval', false);
g_form.setDisplay('approval', false);
g_form.setSectionDisplay('manual_approval', false);
g_form.setSectionDisplay('related_records', false);
g_form.hideRelatedList('incident'); // name of related list
g_form.hideRelatedList('problem');
g_form.hideRelatedList('change_request');
g_form.hideReleatedList('sc_req_item');
g_form.hideRelatedList('task_sla');
g_form.hideRelatedList('task_ci');
g_form.hideRelatedList('sysapproval_approver');
}
}
Thanks!