- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:01 AM
Hi,
I have to hide configuration_Item on RITM form only for a specific Item : Item1
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?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:02 AM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:02 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:10 AM
Thank you
done with UI policy 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:10 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:11 AM
Thank you Ankur,
done with Ui policy