Onload Collapse Script not working

ChrisWing
Mega Guru

I found a previous post about using a Client Script to collapse all containers onLoad.  I have put this into place however it does not appear to be working.  Has something changed that it won't work in Yokohama?

 

Below is what I have which is very simple.

 

function onLoad() {
setCollapseAllIcons('collapse', '');
expandCollapseAllSets(false);  
}
 
I have two containers that I am trying to have start collapsed when a requestor initially opens the form.  Is there a flaw in my approach?  Why would this script not be working?  Do I need to specifically call the containers out using 
 
toggleVariableContainer('XXXXXXXXXXXXXXXXXX');
 
Appreciate any feedback as always
1 ACCEPTED SOLUTION

ChrisWing
Mega Guru

I just opted for the togglecontainer command as that seems to work, I will assume the other one ended up depreciated as it was originally offered as a solution back in Geneva.

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@ChrisWing 

this is for normal form or catalog form?

what debugging did you do?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hey Ankur,

 

This is for a catalog form.  I have created the catalog item and added this as a client script.

 

From a debugging perspective as it is just a toggle it either works or doesn't I guess I could add a info message an ensure that comes up but otherwise pretty clueless. I am about as basic at coding as can be.

ChrisWing
Mega Guru

I just opted for the togglecontainer command as that seems to work, I will assume the other one ended up depreciated as it was originally offered as a solution back in Geneva.