- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 11:11 AM
Hi Everyone, I have a knowledge base hierarchy that looks something like this:
Benefits
Medical
Dental
Life Insurance
I want to write a query where I filter the kb_category by the parent_id so that it returns all articles in the general Benefits category. I've written the following, but it does not work:
ka.addQuery('kb_category.parent_id', 'f939ebf6db25ba00179c73abbf9619ba');
I noticed that the type for parent_id is document_id and I read somewhere that those types of variables cannot be dot-walked. Is there another way where I can filter my query to just have parent_id = Benefits?
Thanks.
ka.addQuery('kb_category.parent_id', 'f939ebf6db25ba00179c73abbf9619ba');
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 03:34 PM
Hello David,
You should be able to dot-walking to parent_id. I just created a sample script and it worked fine.
Sample
var gr = new GlideRecord('kb_knowledge');
gr.addQuery('sys_id','e97ee81eff6002009b20ffffffffffe0'); //Hardcoding sys_id for testing purpose
gr.query();
while(gr.next())
{
gs.addInfoMessage(gr.kb_category.parent_id);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 03:34 PM
Hello David,
You should be able to dot-walking to parent_id. I just created a sample script and it worked fine.
Sample
var gr = new GlideRecord('kb_knowledge');
gr.addQuery('sys_id','e97ee81eff6002009b20ffffffffffe0'); //Hardcoding sys_id for testing purpose
gr.query();
while(gr.next())
{
gs.addInfoMessage(gr.kb_category.parent_id);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 06:42 PM
Hey Pradeep, thanks for your help. I didn't change any of my code, but I logged out and logged back in and now the code works. Super strange stuff...