Hide Sections on Service Portal

sajan_high_0192
Mega Contributor

Hi All,

using g_form.setSectionDisplay(sectionName, isVisible) is not hiding sections in service portal.

Dose any one know solution for this issue?

I am working on Helsinki.

Thanks,

sajan

23 REPLIES 23

jesseadams
ServiceNow Employee
ServiceNow Employee

Are you using a client script or UI Policy?


There is currently PRB722129 open for setSectionDisplay not working in service portal when used in a UI policy.


As far as I know it should work in a client script though. If you're using a client script can you post your script so we can take a look?


Hi Jesse,



I have tried a client script whose UI$$('.veditor_header')[0].innerHTML = 'Customer Request Form';e is selected as both and i have just used a single if else block in the script.But it doesnt work.


Script:-


try{



if(g_user.hasRoles()){


alert('inside sectii0n');


g_form.setSectionDisplay('Section Name', true);


}


else{


alert('inside else');


g_form.setSectionDisplay('Section name', false);


}




}catch(e){}



Its giving me the alert in portal but not hiding the section.



Any immediate help is appreciated.



Regards,


Zabeeulla.


Hi Zabeeulla,


I just tried using this in a client script and it doesn't seem to work there either. It looks like we need to get the documentation in the PRB updated to reflect that.


I did some further research and it looks like this did work in a client script in Helsinki but in Istanbul and Jakarta it is no longer working there either.


For example, this simple client script:



function onLoad() {


    g_form.setSectionDisplay('related_records', false);


}



would hide the related records section if used in the portal in Helsinki but it does not in Istanbul.