How to make variables in variable set mandatory?

Ansuha Chipuri
Kilo Guru

Hi,

I have catalog form with some variables and a variable set with few variables 

Now I want to make some variables mandatory on the variable set based on the variable value on the catalog form.

How can I achieve this.

Thanks in advance!!

1 ACCEPTED SOLUTION

Hi,

got it

Please use onload catalog client script which applies on Catalog Item and not variable set

then you can access the variables inside variable set using g_form object

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

11 REPLIES 11

mr18
Tera Guru
Tera Guru

Hi Anusha

You have to create catalog UI policy on the particular catalog item

In catalog conditions, select the variable and then in Catalog UI policy Action select the variable you want to set as mandatory

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use onload catalog client script

Applies to Catalog Item

Applies on Catalog Task - True

function onLoad(){

if(g_form.getValue('variable') == 'your value'){

g_form.setMandatory('variable1', true);

}

}

You can also use Catalog UI Policy for this with no scripting

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur, 

I want to make variables in variable set mandatory based on variables on catalog form variable value.

if i use ui policy for catalog item.  i am unable to access variables of variableset in ui policy actions

Hi,

got it

Please use onload catalog client script which applies on Catalog Item and not variable set

then you can access the variables inside variable set using g_form object

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader