Hide Variable Set

Bhushan_Salseka
Mega Expert

Hello All,

I have created a variable sets. But on particular selection i am able to hide variable of variable sets. But i am not able to hide variable set title or header bar.

Can anyone suggest it.

Thanks

Regards

Bhushan Salsekar

1 ACCEPTED SOLUTION

Mujtaba Amin Bh
Mega Guru

Hello Bushan,



try this g_form.setDisplay('variable_set_name',false);



Replace 'variable_set_name' with the name of your variable set.



This will hide the complete variable set including title. You don't have to hide variables individually.



Do let me know if it works?


View solution in original post

20 REPLIES 20

dougpenta
ServiceNow Employee
ServiceNow Employee

I am having the same issue.   I've tried using g_form.setDisplay('variable_set_name',false); (Helsiki release) and it is not working for me.



Any help here is appreciated.   Otherwise I'll have to hide all variables individually 😕


dougpenta
ServiceNow Employee
ServiceNow Employee

Eloybayona   I have found the answer to the problem, the method is setVisible not setDisplay.   This might have changed with the Helsinki release.


doug.penta I see that setVisible works, but it makes the form not look very good if I just replace all of the setDisplay calls I have in some forms. The main issue I found is that when there are UI policies already on variable sets and I am trying to call setDisplay in a catalog client script on the catalog item that includes the variable set then the setDisplay method does not work to hide the whole variable set. So I am hiding each variable one by one instead and this works if it is done onLoad and the variables are blank at the time the client script is called.


Community Alums
Not applicable

If you're using containers, you can hide the container start variable using a UI policy, and the entire set of variables within the container will be hidden. I've done this for variables sets successfully, instead of hiding each individual variable. The caveat being you need to wrap your variables in a container.


tjvd
Giga Contributor

Hi,



I tried both setDisplay and setVisible to hide variable sets using a Catalog UI policy script. However, it appears to work from the normal application, but not when I access the catalog item via the Service Portal (Helsinki release). Has anybody succeeded in hiding variables sets on catalog items on the Service Portal using UI Policy script?



Thanks!



Tjie-Jau