Collapse Section on Variable Set

rsanon
Tera Contributor

I was reviewing useful scripts on the wiki - http://wiki.servicenow.com/index.php?title=Collapse_Section_on_Forms

 

Is it possible to do something similar for a variable set?

1 ACCEPTED SOLUTION

Mark Stanger
Giga Sage

As long as you check the 'Display title' box on the the variable set you can use the following code (including the sys_id of the set) to toggle the display.



toggleVariableSet('SYS_ID_OF_VARIABLE_SET_HERE');


View solution in original post

9 REPLIES 9

Hi Mark,



What would the full script look like if I wanted to collapse the variable set?   Here is what I have so far, but does not seem to be working..



function onLoad() {


  toggleVariableSet('variable_set_sys_id', false);


}



Appreciate your help.



Thanks,


Patrick


That should work as long as you're supplying the actual sys_id of the variable set.


No Luck. i tried with below script , but not working.


Currently we are Helsinki.


function onLoad() {


  //   toggleVariableSet('d84942f56fe482005de9f00dba3ee460', false);


  // togglevariablecontainer('d84942f56fe482005de9f00dba3ee460');


  toggleVariableSet('d84942f56fe482005de9f00dba3ee460', false);



}


We just upgraded to Helsinki.   We had some problems with slush buckets not loading properly, so I opened a ticket to fix that.   The "solution" was to disable the script that we'd created in the Berlin version that did this very thing.   I was told by support that this   toggleVaribleSet is no longer supported and they provided no solution for this.



The script was:


function onLoad() {


    if(g_form.getValue('order_guide') == 'true'){


      toggleVariableSet('ab183c84c47cc100c5de2507254e974c'); //This is the sys_id of the Variable Set:


    }


}


joeprewitt
Kilo Contributor

We are running Istanbul and the toggleVariableSet() command was not working.



I ended up find the following command, "toggleVariableContainer('YOUR_SYS_ID_HERE');" and it worked perfectly. My variable sets loaded in a collapsed state.



function onLoad() {


      toggleVariableContainer('YOUR_SYS_ID_HERE');


}