- 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
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
08-28-2020 08:08 AM
Hope you are doing good.
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
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
08-31-2020 07:32 AM
Hi
Unfortunately it is working only on incident, problem section.
It is not working on affected CI, Requested items related list .
Also the section is not working on few of the sections.
I have written proper syntax and table name.
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('Manualapproval', false); // name of section
g_form.hideRelatedList('incident'); // name of related list
g_form.hideRelatedList('problem');
g_form.hideRelatedList('change_request');
g_from.hideReleatedList('sc_req_item');
g_form.hideRelatedList('task_sla');
g_form.hideRelatedList('task_ci');
g_form.hideRelatedList('sysapproval_approver');
g_form.setDisplay('u_vendor_id_reference', false);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2020 10:31 AM
if the name is proper then it should work
Can you share for which form it is not working
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
08-31-2020 08:56 PM
Also if I write a UI policy or Client script when the form is loading at that moment it shows all the fields and once the form is loaded it shows the correct ones. so how can we fix this ? Do we need to use a BR instead?
On the Requested Item form below are not working, Also attaching the screenshot below:
g_from.hideReleatedList('sc_req_item');
g_form.hideRelatedList('task_sla');
g_form.hideRelatedList('task_ci');
g_form.hideRelatedList('sysapproval_approver');
g_form.setSectionDisplay('Manualapproval', false)
Thanks!