- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2019 02:00 AM
hi team,
i am trying to hide variable set in mobile view, for that i have written onload client script for that variable set as below, the same logic is working for variables in item, where as it is not working for variable set items, please find below code and help me on the same. FYI, i am getting both the alerts below, but hiding is not
happening
function onLoad() {
//Type appropriate comment here, and begin script below
var loc = top.location.toString();
loc = decodeURI(loc) ;
alert('hello'+loc);
if (loc.indexOf('mob_order_guide') >= 0) {
alert('hello2');
//g_form.setDisplay('Policies',false);
//g_form.setDisplay('Links_to_MAC_FAQ_and_it_policy',false);
g_form.setVisible('Policies',false);
g_form.setVisible('Links_to_MAC_FAQ_and_it_policy',false);
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2019 02:19 AM
Hi,
Change: Applies to --> Catalog Item and select the catalog item name instaed of Variable set name
Use this g_form.setDisplay('VARIABLE_SET_NAME',false); on UI Policy or Client Script.
Replace 'VARIABLE_SET_NAME' with the name of your variable set.
Thanks,
Bhojraj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2019 03:44 AM
Hi,
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks,
Bhojraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2019 03:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2020 02:31 AM
Hi Bhojraj,
I am trying to hide variable set in a same way you proposed but its not working. I am on Madrid version.
Please assist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2023 01:13 PM
In my case I also needed to check that there aren't any containers in your variable set. If there are, you'll need to handle the containers in the variable set with their own line of code to set their visibility.
ServiceNow sees the variable set as something like a container, so having containers in the variable set confuses the UI Policy a bit.