- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2014 08:37 AM
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?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2014 08:45 AM
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');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2016 10:32 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2016 10:46 AM
That should work as long as you're supplying the actual sys_id of the variable set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2016 05:27 AM
No Luck. i tried with below script , but not working.
Currently we are Helsinki.
function onLoad() {
// toggleVariableSet('d84942f56fe482005de9f00dba3ee460', false);
// togglevariablecontainer('d84942f56fe482005de9f00dba3ee460');
toggleVariableSet('d84942f56fe482005de9f00dba3ee460', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2016 10:16 AM
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:
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2017 04:50 AM
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');
}