Have to make a variable inside the variable set mandatory based on another variable on catalog form

nausheen
Kilo Contributor

Have to make a variable inside the variable set mandatory based on another variable on catalog form.

3 REPLIES 3

Allen Andreas
Administrator
Administrator

Hi,

You can use a client script on the variable set and sample script such as:

if (parent.g_form.getValue('field_name') == 'value') {
g_form.setMandatory('field_name', true);
}

Keep this guidance in mind as well for MVRS and mandatory field situations: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0778516

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Jaspal Singh
Mega Patron
Mega Patron

You need a Catalog UI Policy or Catalog Client script on the Catalog item level instead of variable set level.

Creating it at catalog item will allow you to select variables across variable sets associated to the catalog item

I don't think a UI policy is going to work as we need to make the variable inside the variable set mandatory .
I tried doing this we cant fetch variables from variable set.
I am looking for a client script instead.

Thanks