How do you get the attachment's sys_id that is on the kb_knowledge

feco
Kilo Contributor

How does the table kb_knowledge link to sys_attachment.   I'm trying to get the sys id of the attachment that is on the kb_knowledge.

1 ACCEPTED SOLUTION

Mihir Mohanta
Kilo Sage

Hi Florence,


Write a business rule on the Knowledge table.



Inside script, write a Glide query to sys_attachment table.Like,



var attachment = new GlideRecord('sys_attachment');


attachment.addQuery('table_sys_id',current.sys_id);


attachment.query();


while(attachment.next()){


gs.addInfoMessage('sys_id of the attachment is : ' +attachment.sys_id);


}



Thanks,


Mihir


View solution in original post

13 REPLIES 13

Abdul Khan4
Kilo Guru

All attachments are saved in sys_attachment table. You need to get the sys_id of knowledge article and search in Table sys ID. Open the record and you will get sys_id of attachment.



find_real_file.png


How do I find the sys_attachment table?   I have a document that I need to find the sys id.


In the left navigation menu search box type sys_attachment.LIST and click enter.



Thanks,


Mihir


I have access to the sys_attachment table, but there's no correlation back to the KB article(s).  How do I reverse search back to the KB article to see where the Attachment actually is in the KB?  I want to instruct the Knowledge workers to STOP attaching monstrously large attachments.