Hide field on RITM

Nawal
Mega Guru

Hi, 

I have to hide configuration_Item on RITM form only for a specific Item : Item1

find_real_file.png

 

I m trying with this but seems not work :

function onLoad() {
//Type appropriate comment here, and begin script below
if(g_form.getValue('cat_item').includes('Item1')){
g_form.setVisible('configuration_item',false);

}
}

Any idea please? 

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi,

You can use UI Policy to set the condition that if item is 'x', then use a UI Policy action to hide that field (visible = false).

It's always recommended to try UI Policy first, before client scripting, etc.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

4 REPLIES 4

Allen Andreas
Administrator
Administrator

Hi,

You can use UI Policy to set the condition that if item is 'x', then use a UI Policy action to hide that field (visible = false).

It's always recommended to try UI Policy first, before client scripting, etc.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Thank you

done with UI policy 🙂

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

As mentioned by Allen you can use UI policy always much better to maintain and no script involced

But if you wish to use client script here is the update

function onLoad() {
	//Type appropriate comment here, and begin script below
	if(g_form.getDisplayBox('cat_item').value.indexof('Item1') > -1){
		g_form.setVisible('configuration_item', false);
	}
}

Regards
Ankur

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

Thank you Ankur, 

done with Ui policy