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.

setVisible on Variable Set in Catalog Item onLoad script

jasonthorngren
Giga Contributor

I have record produce which I run g_form.g_form.setVisible('variable_set_1', 'false'); in a onLoad script and it hides the entire variable set, however, I try the same technique on a Catalog item and it does not work.  I have also tried setDisplay as well. I usually end up having to code it for each variable in the set.  I did notice that setVisible needs true/false set in '' and that setDisplay does not.  Is there something I am missing?  I tried copying the exact same script from the record producer to the catalog item still fails.  I know the script is running from the console log but that one line of code seems to not happen.  Please, any help is appreciated.  Thanks!!

5 REPLIES 5

Elijah Aromola
Mega Sage

Have you tried the following:

g_form.setVisible('variable_set_1', false);

This did not work...

find_real_file.png

 

 

Prateek kumar
Mega Sage

try variables.variable

https://community.servicenow.com/community?id=community_question&sys_id=15204361db98dbc01dcaf3231f96...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

I believe this is to hide a single variable in the set.  I am trying to hide the entire variable set onLoad.  I have it working on a record producer but I copy the same code to a catalog item and it does not work.  The code on the record producer is as follows:

g_form.setVisible('vs_name', 'false');