Client Script for Catalog Item - Show only those variables and variable sets with value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-24-2022 05:00 AM
I am trying to create a client script for a complex catalog item.
This client script should only apply to Requested Items and Catalog Tasks AND only show variables and variable sets with values since there are about 30 variables.
My logic is:
- On Load, Get all variables and variable sets then iterate on each to check if there is a value. - Don't have any idea if there is an a function OOTB that can do this
- For every variable and variable set with value, set visibility to true.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-24-2022 05:31 AM
Hi hanaphouse
check this blog which has solution for your requirement
https://community.servicenow.com/community?id=community_blog&sys_id=50b9aa94db0818d823f4a345ca961945
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-28-2022 09:25 AM
This is helpful. Instead of the BR, I have used full client script solution where I have created an array of all variables then go through it. I wished there was an OOB solution like g_form.showVarsWithValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-27-2022 05:10 PM
Could you share how you created an array? That sounds like an interesting implementation.