logo

NJP

New "Hide" variable field (onLoad)

Import · Feb 09, 2021 · article

Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

Hi there,

Scrolling through the Quebec release notes for Service Catalog improvements, you might have noticed the three improvements for Variables. One of these, "Make a variable read-only or hide it while defining the variable". This sounds promising, solving cases for which you would create a dummy onLoad Catalog UI Policy and UI Policy Action to hide a Variable.

Let's have a closer look.

Quebec: Enhancements for variables

The Service Catalog release notes mentions:

  • Make a variable read-only or hide it while defining the variable.
  • Make a question choice inactive.
  • Make a group of CheckBox variables mandatory in Service Portal.

Hiding Variables onLoad

There are cases where you need a Variable that will not be visible when submitting a Catalog Item, or Variables that should get Visible conditionally after (multiple) conditions have been met. In those cases, the Variable needs to be hidden onLoad. Up to now, you would achieve such only by creating a Catalog UI Policy and Catalog UI Policy Action or through an onLoad Catalog Client Script.

This is where the new "Hidden" field on Variables come into place!

image

This sounds promising. Simplifying Catalog Items, eliminating some dummy Catalog UI Policy and Catalog UI Policy Actions and Catalog Client Scripts.

Hiding Variables conditionally

So what if you still need to make the Variable visible, due to some conditions in your Catalog Item design? I tested with Catalog UI Policy and Catalog UI Policy Action and Catalog Client Script, no issues at all! Just your regular way of making a Variable visible.

image

image

Result

Such a small and simple enhancement to Variables which you might overlook pretty easy. Though such a nice enhancement! Eliminating components that previously were really needed, reducing complexity, and now just a simple checkbox on the Variable itself.

A welcome small though very effective enhancement!

---

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

Kind regards,

Mar k Roethof

ServiceNow Technical Platform Architect @ Quint Technology

2x ServiceNow Developer MVP

2x ServiceNow Community MVP

---

View original source

https://www.servicenow.com/community/developer-articles/new-quot-hide-quot-variable-field-onload/ta-p/2311473