- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2022 11:05 PM
I have field in a variable set and this variable set is included in 130 catalog items.
And I want this particular field to be hidden for 2 catalog items and show in all 128 catalog items.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2022 11:14 PM
2 Approaches
1) you can use 1 onLoad catalog client script for your variable set
Applies to Variable set - True
Then check the sysId of the current catalog item and if it's one of those 2 then hide it
function onLoad(){
var sysId = g_form.getUniqueValue();
// give the 2 catalog item sysIds here
if(sysId == 'catItemSysId1' || sysId == 'catItemSysId2'){
g_form.setDisplay('variableName', false);
}
}
OR
2) Create individual Catalog UI policy on those 2 catalog items and hide that variable
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
‎07-05-2022 11:08 PM
Hello ,
you can write UI policy at catalog item level but not inside a variable set
open your catalog item and create a catalog UI policy to hide that particular field .Please do it for both the catalog items
Please accept this solution if it helps you
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2022 11:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2022 11:14 PM
2 Approaches
1) you can use 1 onLoad catalog client script for your variable set
Applies to Variable set - True
Then check the sysId of the current catalog item and if it's one of those 2 then hide it
function onLoad(){
var sysId = g_form.getUniqueValue();
// give the 2 catalog item sysIds here
if(sysId == 'catItemSysId1' || sysId == 'catItemSysId2'){
g_form.setDisplay('variableName', false);
}
}
OR
2) Create individual Catalog UI policy on those 2 catalog items and hide that variable
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
‎03-14-2023 12:27 AM
Hi @Ankur Bawiskar When I tried to use g_form.getUniqueValue() in onLoad client script scoped application it is returning me sysid of variable set but not record producer. Is there any work around?
TIA