Issue with visibility of containers in RITM and Catalog Task form

peter_repan
Tera Guru

Hi all,

I'm facing curios issue.

I have a container with many variables in my Catalog item form.

I would like to hide this container on RITM and Catalog Task form.

When I'm creating Catalog UI policy with Action (visibility = false) for this container - it does not work.

I also tried to hide container in onload Catalog Client Script (g_form.setDisplay('container_name', false)   or g_form.setVisible('container_name', false) - but also does not work.

If I hide another type of variable (like textbox, selectbox...) it works fine, but for container it does not work.

Do you have any ideas what could be wrong?

Is this out-of-the-box behavior that containers cannot be hidden in RITM and Catalog Task forms?

By the way, showing/hiding containers in Catalog Item form works like a charm.... : (

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee
4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Pradeep,



thank you for the link: Is it possible to hide variable container in requested item [sc_req_item] form using a client script...


I found here a workaround for my issue.



As mentioned in the thread, I used:


$j("tr#container_9ff1123284de0a40ac0acf42fd11e5a4").hide();



in onload client script and it works.


I'm not very happy with such "sys_id hardcoding" but for now it's the only workaround I found.



btw, I tried to "google" the answer first, but did not find link above


Hi peter.repan, see if this article helps out with hiding that container (and eliminates hardcoding the sys_id's) via your Catalog client script: Show/Hide Form Section by Name - ServiceNow Guru. There are comments that speak your specific situation, which I've also included below.




Phil Wright 21-03-2013, 14:37

How about a script to collapse containers on a catalog form. Not all containers but specific named containers.


Thanks,
phil


Reply








Joshua Bice 10-12-2014, 08:13


Phil,


I use an onLoad client script with the following message:


toggleVariableSet(");


You can use a var = g_form.getReference("); Then a .sys_id if you need to do it without hardcoding the sys_id.


Reply


PANKAJ MAHTO1
Tera Expert

Hi Team,

 

Yes !!!! We can Show/Hide "Container Start" Variable' Display Value for a Catalog Item in Portal.

Note:- I have fixed by Using "UI Policy Script" and "UI Policy Action".

1. Create an UI Policy as per your condition to Show/Hide the "Container Start" field LABEL.

2. Write below Script Together on Script Part-

 

SCRIPT:-

function onCondition() {

g_form.setDisplay('variables.high_performance_computing_linux_unix_ah', false)// Enter the Value of the Variable.
}

find_real_file.png

3. Create UI Policy action for the "Container Start" variable and Make below changes

 

A). Mandatory = FALSE

B). Visible = FALSE.

 

find_real_file.png

 

RESULT:- Now Based on condition. "Container Starts" field Label can be Show/Hide.

************************************************************************************************************************************************************

Example:-

Before Condition Fulfilled- "Container Start" Variable Field Label "High Performance Computing" Can bee seen.

find_real_file.png

 

AFTER CONDITION MATCHED:-

 "Container Start" Variable Label is HIDDEN-

 

find_real_file.png

 

Important:- "Container End" Variable Should be Just after "Container Start" Order. You May adjust later for other variable with New Container Start but to Achieve this you have to Create 1-1 (Container Starts && Container End).

find_real_file.png