Collapsed section in agent workspace form. g_aw.sectionExpanded is not working as expected.

kashyap6
Tera Contributor

Hi All,

There is a requirement where we are supposed to collapse the sections by default. We have used g_aw.sectionExpanded('section_name',false) on load of the form. This collapse the section as expected.

 

kashyap6_0-1667884053378.png

 

However, when we try to save this from agent workspace the whole details tab disappears.


kashyap6_1-1667884124648.png

 

Please help me out if anyone has faced similar issues.

 

@Ankur Bawiskar 
@Omkar7 
Kindly help if you can. Thanks in advance

12 REPLIES 12

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

For me it works perfectly fine with the below code:-

 

function onLoad() {
   g_aw.setSectionExpanded('notes', false);//notes is the name of the section
}

 

You can follow the below article and check if you are missing something:-

 

https://docs.servicenow.com/en-US/bundle/tokyo-platform-user-interface/page/administer/workspace/con...

 

Please mark my answer as correct based on Impact. 

Hi @Saurav11 

I have used the same documentation.
I am getting the below error in console when i try to save this:

 

kashyap6_0-1667889225205.png

Thanks,
Swetang Kashyap

hello,

 

Can you paste the screenshot of you client script code

Hi @Saurav11 

kashyap6_0-1667890438845.png

 

kashyap6_1-1667890465331.png

 

 

function onLoad() {

 


g_aw.setSectionExpanded('case', false);

g_aw.setSectionExpanded('network', false);
g_aw.setSectionExpanded('site_details', false);
g_aw.setSectionExpanded('alert_information', false);
g_aw.setSectionExpanded('credentials', false);
g_aw.setSectionExpanded('closure_information', false);
// g_aw.setSectionExpanded('case', false);
g_aw.setSectionExpanded('procedure', false);

 


}