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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2019 12:48 AM
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
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2019 12:56 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2019 09:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2019 11:35 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2021 07:32 PM
Hope this link could help in a way