- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2021 08:45 AM
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.
Please help.
Thanks,
Priya.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2021 08:53 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2021 09:26 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2021 10:02 PM
Hi Ankur,
Yes, it is working. I have given true instead of false.
Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2021 10:06 PM
Glad to help.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader