Filter reference field in a variable set

Glenn H
Tera Guru

I have a variable set that is used in multiple catalog items.  I'd like to use the variable set on a catalog item to maintain our standards but I'm unsure how to filter that field for only this form.

 

It's a location table where I'm searching for a specific type of building.  I tried the simple filter but it applies to all instances of the variable set.  Not sure where to go from here so any assistance will be greatly appreciated.

 

Thank you!

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

You'll need to hide the reference variable on this one Catalog Item, and create a new one to use with the different filter.  If you are concerned about reporting or workflow that uses this variable value, you can set the value of the one in the variable set equal to that of the new one, keeping it hidden or read only, so that nothing is disrupted.

View solution in original post

5 REPLIES 5

tommike070
Tera Contributor

To filter a variable set on a specific catalog item without affecting other items, you can use a script in the catalog item’s *onLoad* client script. Since filtering within a variable set applies globally, applying a dynamic filter condition through scripting is the best approach. You can target the field within the specific catalog item by adding a script that applies the filter only when the particular catalog item loads. Use `g_form.setDependentField()` or `g_form.setOption()` to customize the filter for the location table field based on your specific building criteria. This way, you maintain the standard variable set but apply the filter only for the relevant item. spotify premium apk pc

Brad Bowman
Kilo Patron
Kilo Patron

You'll need to hide the reference variable on this one Catalog Item, and create a new one to use with the different filter.  If you are concerned about reporting or workflow that uses this variable value, you can set the value of the one in the variable set equal to that of the new one, keeping it hidden or read only, so that nothing is disrupted.

Brad Bowman
Kilo Patron
Kilo Patron

Here's an alternative approach that works without creating a new variable

https://www.servicenow.com/community/now-platform-articles/yes-you-can-effectively-set-or-update-a-r... 

LunaO
Kilo Contributor

Hi,
I'm encountering an issue while trying to filter a reference field in a variable set on site, . Despite setting the filter conditions, the reference field doesn't seem to be applying them correctly.

Has anyone experienced a similar issue? How can I resolve this? Any insights would be greatly appreciated.