logo

NJP

Mandatory Multi-Row Variable Set

Import · Dec 08, 2019 · article

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

Hi there,

While working with the Multi-Row Variable Set on Catalog Items, a while ago I stumbled on making the Multi-Row Variable Set mandatory. Mandatory like having to add at least one record. Because recently I answered multiple community questions on this topic also, I thought let's give it a try to write an article with some additional information.

Default behavior

When setting up a Multi-Row Variable Set, and adding this to a Catalog Item or Record Producer, the default behavior looks something like:

image

Mandatory

On the Multi-Row Variable Set record itself, notice there's no mandatory flag for example. Sometimes there is, though it's just not on the form layout… in this case, absolutely no kind of mandatory flag.

image

Though available options which are helpful are:1) Catalog Client Scripts

2) Catalog UI Policies

I've seen several example of Catalog Client Script usage on the Community. Though, because we want to explore No-code solutions first, let's have a look at Catalog UI Policies.

Catalog UI Policy

When adding a Catalog UI Policy and the Catalog UI Policy Actions on the Catalog Item level (not on the Multi-Row Variable Set level!), notice the available Variables on the Catalog UI Policy Action:

image

The Variable name field will list all Variables and all Multi-Row Variable Sets! Knowing this, is the actual gem of this whole story image Simply select the Multi-Row Variable Set, and change the Mandatory field to "True".

Note: On the Catalog UI Policy you don't need to add any conditions. In that case, the Catalog UI Policy Action will immediately be applied onLoad.

Result

image

Obviously, when one or more records added, the mandatory check is fulfilled. Just identical to the behavior of normal Variables.

---

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

Kind regards,

Mark Roethof

ServiceNow Technical Consultant @ Paphos Group---

LinkedIn

image

View original source

https://www.servicenow.com/community/developer-articles/mandatory-multi-row-variable-set/ta-p/2310800