Can I hide a Section(tab) using a UI Policy?

Community Alums
Not applicable

I have a requirement to hide section without condition - can I achieve this through a UI policy?

 I tried this option no luck..

On the When to apply tab, add your conditions.

On the Script tab, select "Run Scripts" then enter the following

Execute if True

function onCondition() {
g_form.setSectionDisplay('Accounts', true);
g_form.setSectionDisplay('Finance', true);

}

Execute if False

function onCondition() {
g_form.setSectionDisplay('Accounts', false);
g_form.setSectionDisplay('Finance', false);

}

any idea how to achieve this.?

Cheers,

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Blog of ServiceNow Guru should help.

View solution in original post

5 REPLIES 5

Alp Utku
Mega Sage

Yes, you can.

Just create a UI Policy without condition and go to UI Policy actions tab and select field(s) / section you want to hide by setting Visible select box to false. 

 

 

 

Gabby2
Kilo Contributor

Can you clarify how to select the sections you want to hide? I only see an option to select fields.

Jaspal Singh
Mega Patron
Mega Patron

Blog of ServiceNow Guru should help.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

whenever script is involved I would suggest to use onload client script; also you want to hide it always you can use onload client script without any condition

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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