Restrict contextual search in catalog items to only record producers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 02:40 PM
I am trying to add contextual search to my catalog items. I have made a lot of progress but I am now just attempting to restrict the results for this particular Catalog Item show only Record Producers. Catalog Items and Standard Changes should be filtered out.
I have created the following script
(function(current, query_table){
/**
* current: A GlideRecord representing the Form or Record producer
* query_table: The table to compare value on
*
* Use the standard query features of GlideRecord to add conditions to query_table.
* Current prepresents the current values on the user's form or record producer that
* can be used to add live conditions to the query.
*
* E.g. query_table.addQuery("active", current.active);
*
* The return value should always be the encoded query, usually query_table.getEncodeQuery()
*/
query_table.addActiveQuery();
query_table.addQuery(sys_class_name=RecordProducer);
// Return the encoded query
return query_table.getEncodedQuery();
})(current, query_table);
However it doesn't appear to be filtering. I know this is the correct path as before with different syntax it broke the search, and now while it works it isn't filtering. Appreciate any guidance to what I may have missed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 03:36 PM
Hi @ChrisWing
Navigate to:
Adjust existing or create new and with the related lists you should be able to achieve it.
Let me know how did it go
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 06:11 AM
Hey KamIIT,
I did set up a context as well, and even tried to filter it the way I wanted but it doesn't seem to be applying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 09:35 PM - edited 07-17-2025 09:35 PM
Hi @ChrisWing ,
Can you try like this
query_table.addQuery("sys_class_name=sc_cat_item_producer");
instead of
query_table.addQuery(sys_class_name=RecordProducer);
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thanks, GP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 06:08 AM
Hello,
That doesn't appear to be the solution. In the screenshot below I am searching for a term Compass and only the circled one is a record producer the others are Standard Changes, and Catalog items. I don't want either of those to show up yet even with that change they still do.