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

Tushar Walveka2
Tera Guru
g_form.setSectionDisplay('schedule', false);

The first parameter is simply the name of your section, which should be completely lower-case.

Sections including spaces should use an underscore in place of the first space with the rest of the spaces removed.

For example, a form section with a label of ‘Schedule and Planning’ would require a parameter of ‘schedule_and_planning’. The second parameter is a true/false boolean that indicates whether the form section should be visible or not.