logo

NJP

Hiding Multi-Row Variable Set Variables

Import · Jan 25, 2021 · article

Hiding a Variable [Pre-Quebec]

Usually one would hide Variables through either Catalog UI Policy in combination with Catalog UI Policy Actions or through Catalog Client Script. For Multi-Row Variable Sets, up to the Paris-release scripting like g_form.setVisible() or wouldn't work. Also applying the Visible field on Catalog UI Policy Actions was read-only on purpose.

So short answer up to the Paris release, hiding a variable within a Multi-Row Variable Set: not possible.

image

Quebec-release

The Quebec Service Catalog release notes mentions:

Enhancements for a multi-row variable set (MRVS)

• Hide a variable in the MRVS so the question does not appear to users.

Hiding a Variable [Post-Quebec]

So let's dig into this! My first thought was, is the read-only field now usable on Catalog UI Policy Actions on Multi-Row Variable Sets? Yes, it is!

image

My second thought was, could you also use scripting like g_form.setVisible() within Catalog Client Scripts on Multi-Row Variable Sets? Well, we need to test this. Previously you could also script this though it would simply not work.

The first test case is a simple Catalog UI Policy with a Catalog UI Policy Action.

image

The second test is a Catalog Client Script using g_form.setVisible().

image

Result

In both cases, the end result is exactly the same. Both work as expected! Oke, it's a simple test. Though you could think of situations where you have a more complicated Catalog Item and Multi-Row Variable Set, having dependencies on which variables to display, etcetera. Though basic mechanism which we need for this works like a charm.

image

image

---

And that's it actually. Hope you like it. If any questions or remarks, let me know!

Kind regards,

Mark Roethof

ServiceNow Technical Platform Architect @ Quint Technology

1x ServiceNow Developer MVP

1x ServiceNow Community MVP

---

LinkedIn

image

View original source

https://www.servicenow.com/community/developer-articles/hiding-multi-row-variable-set-variables/ta-p/2319209