How to make a variable visible from a variable set for only one catalog item

Joshuu
Kilo Sage

Hello All,

How to make a variable visible from a variable set for only one catalog item.

The below checkbox is from a variable set called approval. So I want this to be visible for only one catalog item.

find_real_file.png

Please help.

Thanks,

Priya.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use this onload catalog client script which applies on variable set

1) determine the catalog item sys_id and hide it

function onLoad(){

var itemSysId = g_form.getUniqueValue(); // gives item sys_id

if(itemSysId != 'your item sysId here'){

// hide it

}

}

Regards
Ankur

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

View solution in original post

7 REPLIES 7

Hi,

the logic should work

you need to hide it when the item is not your catalog item so use

setDisplay('alternate_approver_check', false);

Did you try adding alert inside the if statement and check?

if that variable is mandatory then make it non-mandatory and then hide it

try to use setVisible() instead of setDisplay()

Regards
Ankur

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

Hi Ankur,

Yes, it is working. I have given true instead of false.

Thanks for your help.

Glad to help.

Regards
Ankur

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