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

Hi,

I doubt you can hide the embedded list of Vendor IR References

But the related list should be possible

Is this setup in your PDI and you are ok to share url and some admin credentials please share here

Regards
Ankur

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

@Ankur Bawiskar 

I have set this in my PDI, below is the URL:

https://dev68200.service-now.com/

id: test.123

pwd: 12345

 

Thanks!

 

@kjain 

I just checked and it is able to hide Affected CI, Approvals, Incidents, Task SLAs

I was about to check for other but now could not login to instance

just debug line by line by commenting the g_form.hideRelatedList()

also error here

g_from.hideReleatedList('sc_req_item');

it should be g_form and not g_from

Regards
Ankur

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

Can you login now and try.

Thanks

No success.

Regards
Ankur

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