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 label type variable which has check boxes

DPrasna
Tera Contributor

Hello All,

I have a "Label" type variable below which I have 3 checkboxes as shown below

DPrasna_0-1678813669804.png

And I am trying to control the visibilty via Catalog client script as shown below

 

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading || newValue == '') {
		g_form.setVisible('demo_variable_set', false);
		//g_form.setDisplay('Demo_variable_set.dev_roles', false);
		//
		return;
	}

	
			
			g_form.setVisible('demo_variable_set', true);

		}
		else{
			///

		}

		//g_form.setValue('variable name',answer);

	}

}

 

However, I am not able to hide the label variable it appears as shown below

DPrasna_1-1678813866162.png

I read from community and a KB that it cannot be hidden.

But I need help with hiding the variable or any possible workaround. Please

 

Entire variable set name - g_form.setVisible('demo_variable_set', false);

 

 

TIA

@Allen Andreas @priyasunku @SatyakiBose @Mark Roethof @BharathChintala 

5 REPLIES 5

I want to hide the entire variable set based on a condition which includes calling a script include.

So I went with client script. In such case the label type variable (Development) is not getting hidden as it contains 3 checkboxes. With UI policy the entire variable set can be set to visible true/false but it does not satisfy the condition so I had to go for client script.

Need help in hiding the label type variable "Development" via client script which I have provided above

 

TIA @BharathChintala @Allen Andreas @priyasunku