OnLoad Client script to hide a variable based on field in the maintain items form.

Maloy Banerjee
Mega Expert

Hi,

 

I have a requirement where I need to hide a variable based on the availability of the value in a field that is present in the maintain items form.

E.g. We have a field in the maintain items form named - 'Approval Group'. Now, if this field is empty then the variable should not be visible in the catalog item view (or Service Portal view).

How can we achieve this?

 

Regards,

Maloy

4 REPLIES 4

Suppi
Kilo Contributor

Hi,

You can use variable set for your variables.

Then you can hide the variable set using g_form.setDisplay('variable_set_name',false); in the catalog client script

Don't Forget to tick the applies to requested items.

Thank you

guruprasad1
Kilo Guru
Hi Onload client script on RITM FORM. Make use of field. Cat_item to get values on catalog item form Regards Guru

siva_
Giga Guru

What do you mean by maintain items form and catalog item view

 Maintain items form - means catalog item configuration form 

Catalog item view - is variables displayed on the catalog item form after client side validations 

So on ritm do you want to show/hide a field based on the catalog item field whether filled in or not ?

 

If yes write a client script on the catalog item and there you can check like Applies to requested item and then Uncheck applies to catalog item and in the script section check for the approval group whether filled in or not if yes display else hide

 

Hope that helps 

Thanks,

Siva 

 

Mark this response as correct if that really helps 

 

Thanks,

Siva

Olu13
Tera Contributor

Hope this link could help in a way