How to use script on Virtual Agent to filter table "sc_cat_item" by "reference type" field -> Category?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 07:17 PM
Dear all,
I tried to use the filter like "category contains Navigation" in the sc_cat_item and no records were found:
Then I used "gr.addEncodedQuery('categoryLIKENavigation')" in Scripts of the "Reference Choice" node in Virtual Agent:
But it can show me 4 records and they really belong to the category of Navigation:
The current problem is that the results displayed by the query in the table and the Virtual Agent query are inconsistent. I know the reason is that Category is a field of type "reference".
So I want to know how to write Scripts so that the results on the Virtual Agent are consistent with the query results of the sc_cat_item table.
thank you very much.
- Labels:
-
Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 09:41 PM
Hi,
in your script in Virtual agent dot walk to title
gr.addEncodedQuery('category.titleLIKENavigation');
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
08-24-2022 12:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2022 01:58 AM
Hi,
The table filter is not working for admins or non-admins?
Did you try to run background script and verify the count?
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
08-24-2022 02:27 AM
Hi
I am the admin and I just tried the two places.
I also can't see the "Navigation" Category in the background table.
So I think Virtual Agent retrieves more results (but I don't know where these results come from)
And I tried in script-background:
It's too much, sc_cat_item has only 41 records in total:
Please help me to locate the problem, thank you.