Managed Documents in Knowledge Base - how can I add to an Incident?

Mickey_Cegon
Tera Expert

We want to upload Recovery Procedures to KB using Managed Documents, but it doesn't appear to give the same options as a regular KB article. The process we need to follow is to have all our Batch Recovery Procedures in Managed Documents create a KB article. Then, when the night operators have an event on a batch process, and create an Incident, they search the KB for the batch job name, and find the procedures. But, they want that article to attach to the Incident like the other KB articles do. When they search, all it does is find the doc, and open it in Word or Adobe, etc. Then, they have to save the doc to their PC, and attach it as an attachment manually. Is this how it's supposed to work? There's no ability for anyone to Flag the article as something to review from the KB either. I read all the wiki articles about setting up Managed Docs and KB, etc, and I didn't see anything regarding this.

 

Thanks,

 

Mickey Cegon

FBL Financial Group, Inc.

11 REPLIES 11

tltoulson
Kilo Sage

Hi Mickey,



Try opening the Knowledge Article that is automatically downloading and change the Attachment link (kb_knowledge.direct) field to false and make sure that Display attachments is true.



When Managed Documents creates an article, it sets Attachment link to true and Display attachments to false.   Since Managed Documents only creates Knowledge Articles that have attachments, it assumes you want to download the attachment, not view an empty article.



Attachment link:   Causes ServiceNow to download the attachment instead of open the article


Display attachments: Causes ServiceNow to show or hide attachments on the knowledge article view



Making this change will allow you to open the article normally.   It will be blank and display the attachments at the bottom if I remember correctly.   You can then click the "Attach to" button as desired.



You may want to make a business rule to enforce this on all articles created by Managed Documents.



So, using the information you gave me, I found the Script Include that was added when I activated the Knowledge Document plugin, called "KnowledgeDocument. In that script include, I changed the one line, and added the other.



knowledgeGR.direct = "false";


knowledgeGR.display_attachments = "true";



My next question is can we actually put some HTML text in the KB article that gets created? We were wanting some custom fields from Managed Docs to follow to the KB article on create/update, but I have no clue how to accomplish this. If it's creating a blank KB article, I'd think we could have something in that script include to populate the actual article as well as add the attachment. An example using an OOTB field from the Managed Docs would be transferring the following:



owner


reviewers


short_description


department



Is this possible?



Mickey Cegon


Hi Mickey,



Yes this is possible.   You will want to modify the knowledgeGR.text field in the Script Include before the insert.   For instance:



knowledgeGR.text = '<b>This is bolded text</b>';


knowledgeGR.text += '<p>This text will be added after the bolded text</p>';


knowledgeId = knowledgeGR.insert(); // This line is already in the script include



The script will have access to:



Fields on the Document Revision that generates the article: Ex) revision.author


Fields on the Document: Ex) revision.document.name



Using these you could do something like:



knowledgeGR.text = '<b>The bolded document name is: ' + revision.document.name + '</b>';




Note on Business Rules instead of Script Include



As I indicated in my previous post, the preferred method is to create business rules rather than updating the Script Include.   Before you modify the script include, ServiceNow silently owns it and may update it automatically and transparently bringing you new and improved behaviors.   After you modify the script, you own the script and it is no longer automatically updated.   You can however manually update it to ServiceNow's script and then reapply your changes but this requires more maintenance.



I have reserved the Business Rule approach for last because while it is preferred, it is also more difficult in this case and may not work.   You will need at least two rules, one on the m2m_document_knowledge table on insert and one on the Knowledge table itself.   This is because the rule has to distinguish between KB's created by Managed Documents and all the other KB's.   The m2m_document_knowledge table is the only way to distinguish.   But this table has two different behaviors governed by the KnowledgeDocument Script Include:



1.   Create a new KB with every Revision


        - A business rule on the m2m_document_knowledge table can handle all the needed behavior for these documents after insert by updating the fields on current.knowledge.


2.   Update an existing KB with each new Revision:   The first revision creates an m2m_document_knowledge record, and no new m2m records are created after that


        - A business rule on the m2m_document_knowledge table will handle updating the KB via current.knowledge on insert for the FIRST revision


        - Subsequent revisions will not add an m2m record (its updating the same KB so the reference has already been created, so we need a business rule on the Knowledge table on update with a condition that it only runs IF a m2m_document_knowledge record exists that references the KB.



So if you would like to pursue the Business Rule method, I can certainly help with that.   The tradeoff is that the Business Rule is a little more complex but should result in lower maintenance whereas modifying the provided Script Include is easier to implement but could result in higher maintenance if ServiceNow updates it.



I hope this has helped.


Hey Travis, You seem to know quite a lot about the managed document plugin. Is there a way to use the managed document plugin in to track knowledge articles without making them attachments? Or really any functionality to do that cleaner? Right now we have over 900 articles in the knowledge base that we wrote using the knowledge base editor (we are in geneva version). We just found the capability of the plugin but the functionality I don't really enjoy about the managed document plugin is that when it creates a knowledge base it uses an attachment. So now overtime someone wants to open a document they have to download it? is there a way around that?