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.

Is it possible to hide variable container in requested item [sc_req_item] form using a client script?

abrahams
Kilo Sage

With Service Catalog requested item I've tried different ways to hide the container in the requested item form but none of my attempts have worked. I seem to be able to hide other variables but I am having problems finding a way to hide containers. I would like to show/hide them based on specific criteria. Would anyone know the trick to hiding containers in a requested item form?

Syntax that I've tried:
g_form.setDisplay('variables.container name',false);
g_form.setVisible('variables.container name',false);

6 REPLIES 6

abrahams
Kilo Sage

After submitting I see that it removed some of my syntax. I want to clarify the syntax I used.

g_form.setDisplay('variables.container_name',false);
g_form.setVisible('variables.container_name',false);


Jim Coyne
Kilo Patron

You need to find out the sys_id of the container and then use:



try {
$("container_03c0169ccd8bf800d16dbf12db4aa87b").hide();
} catch(error) {}


Replace "03c0169ccd8bf800d16dbf12db4aa87b" with the sys_id of your Container Start variable.

The Protoype JavaScript library is included in the platform.


abrahams
Kilo Sage

Oh thank you so much .... this works!


NamrataJain
Kilo Guru

i tried using the container syntax provided above it doesn't works in IE Browser it works fine in firefox and chrome.
Can anyone please help.

Best Regards,
Namrata Jain