via script Tool , how to lookup for the data in the attachement of the KB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Bellow is the script tool which i wrote and it works perfectly fine to extract the information from a kb article, however sometime i am not able to get the requested information from the KB article which has an attachment ( PDF, word, csv, excel):
can someone please assist, how to extract information from kb article which has an attachment ( PDF, word, csv, excel).
Script inputs
Input name
| Description |
number | Knowledge article number |
Script:
(function(inputs) {
// only string inputs are allowed
// return outputs object where the keys in it are understandable by LLM
// Retrieve KB article
var kb_gr = new GlideRecord('kb_knowledge');
kb_gr.addQuery('number', inputs.number);
kb_gr.orderByDesc('version');
kb_gr.setLimit(1);
kb_gr.query();
if (kb_gr.next()) {
return kb_gr.text.toString();
} else {
throw new Error('No KB found with number ' + inputs.number);
}
})(inputs);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
You forgot to add the script you are using. That would be very helpful in assisting you with your question.
A few things you could check: are those articles just an attachment that downloads/opens on click of the KB? Is it not doing anything when there is an attachment, or is it getting the info from the article but just not from the attachment?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey Mark, I have updated the script in the original message. Please have a look..
as I mentioned, it is working as expected to fetch the KB information.. only the problem is with extracting the information from the attachments.
also, as it is being accessed by AI agent ( no download)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Share your code. and also for KB with attachment - are you getting any error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey Tanu, I have updated the original post with the script. please have a look.
