Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hide form sections when no fields present

ebaileyybs
Tera Expert

Hi, I have created a UI policy/actions to hide certain fields under form sections when a particular category of record is selected.

Even though there aren't any fields - the form sections are still showing.

Please can you advise how these can be hidden when the UI policy removes the fields. I have no knowledge of scripting so help on this would be greatly appreciated!

Sections/tabs showing even though fields are hidden:

find_real_file.png

Form sections

find_real_file.png

Thanks in anticipation!

Emma

5 REPLIES 5

nitin_kumar
Mega Guru

Hi Emma,


You have to write an 'On Load' catalog client script to hide the form sections. Following is a sample code


if (//your condition) {


  g_form.setSectionDisplay('name',false); // Write the name of the section


}


else{


  g_form..setSectionDisplay('name',true); // Write the name of the section


}


Thanks,


Nitin



PS: Hit like, Helpful or Correct depending on the impact of the response