How to hide a Related Tab and sections from the RITM form using a UI Policy script.

kjain
Giga Expert

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.

find_real_file.png

 

 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!

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@kjain 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

27 REPLIES 27

@kjain 

I am not sure why Requested Item related list is present on RITM form itself.

Regarding the slowness

there could be multiple reasons for this and you need to fix whichever you can

1) your internet connection is slow

2) your form contains many fields, reference fields and related list taking time to load the page

3) there are many onload client scripts or UI policies running

check below links for help:

Response time on forms

Good practices to improve instance performance through Rowcount, Related Lists and Dashboards

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

In your below IF condition, you need to mention the actual sys_id 

if (g_form.getValue('cat_item') == 'sys_id')

Kindly check.

Mark the comment as helpful if it helps.

In the actual script sys id is mentioned . Here I have removed it.

Thanks!