The CreatorCon Call for Content is officially open! Get started here.

Client Script for Catalog Item - Show only those variables and variable sets with value

hanaphouse
Tera Guru

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.
3 REPLIES 3

Voona Rohila
Mega Patron
Mega Patron

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

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()

Could you share how you created an array? That sounds like an interesting implementation.