- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 07:18 AM
Hi Guys,
I need help. I am creating a mail script to glide the localization requested item table ('sn_lf_requested_item') but the requirement is to exclude document (document id field) from knowledge table ('kb_knowledge') .
Here's some part of my mail script that trying to glide localization requested item record based on localization task and exclude document from knowledge table.
Any advice?
var gr = new GlideRecord('sn_lf_requested_item');
gr.addQuery('localization_task', current.sys_id);
gr.addQuery('document', ???); << not knowledge table
gr.query();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 08:09 AM
Hello @Bird1 ,
Please try using table_name in addQuery
var gr = new GlideRecord('sn_lf_requested_item');
gr.addQuery('localization_task', current.sys_id);
gr.addQuery('table_name', '!=','kb_knowledge');
gr.query();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 08:08 AM - edited 03-03-2023 08:10 AM
Hello @Bird1,
the best way in my opinion to create more complex queries like "is not", "contains", "greater than" etc. is to go in the backend, filter the list as you want it and then copy the query from there. I will show you what I mean in the following screenshots:
1. Create the Query you want in the backend on the localization requested item table (sn_lf_requested_item😞
2. Right klick on the filter and select "Copy query"
3. The result will be "document!=kb_knowledge"
4. Now add this to your glide record with the function "addEncodedQuery()"
5. Your Script should look like this:
var gr = new GlideRecord('sn_lf_requested_item');
gr.addQuery('localization_task', current.sys_id);
gr.addEncodedQuery('document!=kb_knowledge');
gr.query();
I hope this helped. If yes, I would appreciate if you could mark this answer as "correct solution" or give a thumbs up. Thank you!
Greetings,
Sören
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 08:25 AM
Unfortunately the the data type of 'document' field is document id type, I could see it stored the sys_id of record. I tried to exclude kb_knowledge but not work. You could see it still shows the record from knowledge table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 08:09 AM
Hello @Bird1 ,
Please try using table_name in addQuery
var gr = new GlideRecord('sn_lf_requested_item');
gr.addQuery('localization_task', current.sys_id);
gr.addQuery('table_name', '!=','kb_knowledge');
gr.query();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 08:29 AM
It seems to be workable. I am new for this Localization Table, just know that there's table_name field could help to filter. Thanks a lot.