Setter Variable Definition Filtered
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2023 09:44 AM
Hi, I'm a little new and I'm trying to get some concepts for my idea.
So, I have a table "product" with some fields, two of them are:
- a "vendor" who is a reference to the companies;
- a "category" who is a choice with different categories.
I was trying to search for a clean approach to a catalog item for when I select a category, it shows only the brands of products that has that category associated.
In my research I found that using "Catalog Data Lookup Definition" I could link the matcher "category" to setter "vendor". Unfortunately, even when I select a category and the vendor selects a vendor associated with that category, it still shows all the vendors of that table and I could not find a simple way to filter the vendors.
What are good approaches to filter the product vendors that exists on that table that has some company associated?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2023 11:12 PM
Hi @Divalen
I understood you have created,
- A choice field which displays categories
- A Reference type variable which refers to company table
in a Catalog item, and you are trying to display the "Vendors" based on the category selected.
To achieve this you can use a reference qualifier on Vendor variable, You need to create a client callable Script Include which accepts category as parameter and returns sys_id of vendors. And in the reference qualifier call the script include like the one below.
javascript: new CustomCatalogUtils().getVendors(current.variables.category);
You can refer the following link for documentation,
Please let me know if you need more help on this.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2023 11:27 PM
Hi @Divalen
For Variable "Vendor" - You can use Reference Qualifier In "Type specification" tab
javascript:"category=" + current.variables.<category variable name>;
<category variable name> - this will be your catalog item variable name
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates