- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2016 09:42 AM
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2016 05:19 AM
Was this ever fixed in Geneva??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2016 09:21 AM
I worked with support and had to rewrite the script I was using that copied duplicates. I don't think the underlying copy was fixed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 06:50 PM
Hi, Can you share what they solutioned to you? I have the same issue and would love to know how to copy the attachments. What did Support give you?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2016 08:28 AM
The full solution we use is a set of fields to specify import of KB contents to a task, or other record, backed up by a business rule (per table where this is used) and scriptInclude to do the processing.
Fields:
Special Instructions Flag (boolean)
Special Instructions (Reference field to kb_knowledge)
Special Instructions Display (html)
Business rule for any table where the KB copy is enabled:
function onDisplay(current, g_scratchpad) { // When to run: Display // Order: 100 // Filter Conditions: Special Instructions Flag is true //gs.log('InforDebug BSR: In Business Rule'); gs.log('InforDebug BSR: kb sys id is -- '+ current.u_infor_spec_instructions); gs.log('InforDebug BSR: html text is -- '+ getKBhtml(current.u_infor_spec_instructions)); var tblName = current.getTableName(); // get table name of record currently running against (allows reusability) var manageAttach = new InforManageAttachments(); // create new instance of scriptInclude current.u_infor_spec_instructions_display = manageAttach.copyHTMLFromKB(current.u_infor_spec_instructions, tblName); // call function to copy HTML and atatchments to record of tblName manageAttach.deleteDups(tblName); // call function to remove duplicate attachments from record of tblName } The script include is as follows:
var InforManageAttachments = Class.create(); InforManageAttachments.prototype = Object.extendsObject(AbstractAjaxProcessor, { copyHTMLFromKB : function(kbID, tblName) { var kbRec = new GlideRecord('kb_knowledge'); if (kbRec.get(kbID)) { GlideSysAttachment.copy('kb_knowledge', kbRec.sys_id, tblName, current.sys_id); // Added 4/21/2016 - Tamara - copy all attachments from KB record to CTASK return kbRec.text; } else { return ''; } }, deleteDups : function(tblName) { var grSysAttach = new GlideRecord('sys_attachment'); grSysAttach.addQuery('table_name', tblName); //substitute your table name here grSysAttach.addQuery('table_sys_id',current.sys_id); grSysAttach.orderByDesc('sys_created_on'); grSysAttach.query(); var lastID = 'not_a_match'; var lastFile = 'not_a_match'; while (grSysAttach.next()) { gs.log("scriptInclude - Processing sys_attachment record " + grSysAttach.sys_id + " and table_sys_id " + grSysAttach.table_sys_id); var isDuplicate = (lastID == grSysAttach.table_sys_id) && (lastFile == grSysAttach.file_name); lastID = grSysAttach.table_sys_id; lastFile = grSysAttach.file_name; if (isDuplicate) { grSysAttach.deleteRecord(); gs.log(grSysAttach.table_sys_id + ' ' + grSysAttach.table_name + ' ' + grSysAttach.file_name + ' ' + grSysAttach.sys_created_on + ' ' + isDuplicate); } } return; }, type: 'InforManageAttachments' });