how to hide variable set

Deepthi13
Tera Expert

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

find_real_file.png

 

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);
}


}

1 ACCEPTED SOLUTION

Bhojraj Dhakate
Tera Expert

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.

find_real_file.png

Thanks,

Bhojraj

 

View solution in original post

8 REPLIES 8

 

 

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

Hi i have already marked correct before 1 hr only

find_real_file.png

Ashish Sahu1
Tera Contributor

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.

Hendrik Odendaa
ServiceNow Employee
ServiceNow Employee

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.