hide a variable from variable set

dev_K
Tera Contributor

Hello,

 

 

Across many catalog items we use variable set with several variables in it. I am creating now a catalog item that does not use all of those variables so I am looking for the ways of hiding it. 

What is the best solution?

8 REPLIES 8

Community Alums
Not applicable

@dev_K ,

You can usr 

g_form.setVisible('variable_name',false);
This will hide the variable
 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

Sid_Takali
Kilo Patron
Kilo Patron

Hi @dev_K 

g_service_catalog

The g_service_catalog API enables you to access data in a multi-row variable set (MRVS) when a model is open.
This API is available in all environments, such as, Service PortalNow PlatformWorkspace, and Now® Mobile.
 

Example

In this , a catalog item for blocking multiple IP addresses on a firewall has a variable address_type with two choices - IPV4 and IPV6. The MRVS has two variables (ipv4_address and ipv6_address) for the respective address types. If the Address type field on the parent form is set to IPV4, the field IPV6 address is hidden on the MRVS.

 

function onLoad() {
  if (g_service_catalog.parent.getValue("address_type") == "ipv4") {
    g_form.setValue("ipv4_address", "XX.XX.XX.XX");
    g_form.setVisible("ipv6_address", "false");
  }

}

 

 

Please mark this response as correct or helpful if I'm able to resolve your issue.

Regards,

Siddharam Takali 

dev_K
Tera Contributor
function onLoad() {
  g_form.setVisible('channels',false);
}
 
I created this catalog client script and still while testing the variable is showing

Hi @dev_K this should work. I've tried on my PDI its working. Make sure your catalog Client Script UI Type as ALL 

SiddharamTakali_0-1714760681376.png

SiddharamTakali_1-1714760750979.png

Field is not displaying in MRVs

SiddharamTakali_2-1714760780660.png

 

 

 

Regards,

Siddharam