g_form.setDisplay not working for a RITM variable on the backend form using a Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 12:48 AM
Hi, i am trying to hide a RITM variable on the Servicenow backend form using a Client Script but i cannot find a way to actually do it.
I have these variables showing on the form, the two of them are surrounded by a red box here are part of a variable set called dxc_info
The variable i am trying to hide is the second one, called more_info
The only thing that works is hiding the whole variable set, not just the more_info variable. Of course, i am showing here what works and what not, i am not really hiding the variable set and then trying to hide the single variable 😏
i tried the g_form setVisible() method too but it doesn't work too.
Can anyone help me please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 01:18 AM
Can you check if there are any other client scripts or ui policies for that catalog item or on RITM level.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 11:55 PM
Hi @Voona Rohila , i checked and there are aren't any. I opened a case at Servicenow Support because maybe this is a bug involving non a regular field but a variable one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 01:20 AM - edited 11-29-2022 01:35 AM
Hi @Fotios Kossyvas , g_form.setDisplay should work.
I see your script only runs when the page is loaded. Please make sure when you test, your code is executed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 11:58 PM
Hi @Tuan Vu, i verified that my code is executing by putting alerts as debug. It is just that i cannot hide this field, which is defined as variable on a variable set. As i wrote, i can hide the set using g_form.setDisplay but it does not work with this variable. I opened a case at Servicenow Support because maybe this is a bug involving non a regular field but a variable one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 01:28 AM
Hey @Fotios Kossyvas
Do you want to do this only by client script? You can achieve the same by using "Catalog UI policy and action".
Thanks!
MS.