addInfoMessage on Knowledge Article View

Russ T
Kilo Guru

Hello,

I'd like to add an addInfoMessage / addErrorMessage box when viewing a knowledge article - in view mode, not edit mode.

The reason is, that if someone follows a direct link e.g. from an e-mail to a knowledge article that is retired I'd like a box to appear automatically at the top of the page advising this.

At present, if you link directly to an article, a message box appears at the top saying "Exact search match". However, I'm not sure how this is called. On usual forms I'd use a client script of course, but I'm not sure how to do it from a knowledge article view (via kb_view.do).

Thanks

7 REPLIES 7

This would be for forms, not for the article view. Thanks though.


When I was looking to answer your question, I did start with the BR "Add Legacy Information Message".


Since you are interested, here is my full research detail.



addLegacyInformationMessage();


functionaddLegacyInformationMessage() {


varpageName = GlideTransaction.get().getPageName();


varkbKnowledge = new KBKnowledgeBase();


      varkbKnowledgeBaseId = current.kb_knowledge_base;


varshowMessage = (pageName != "angular" && kbKnowledge.isKBVersion2(kbKnowledgeBaseId));


if (showMessage)


      kbKnowledge.setUniqueLegacyInfoMessage(kbKnowledgeBaseId);


}



I think line 8 add some sort of non configurable info message. So, I searched for the KBKnowledgeBase class definition.


I found that its an empty Script Include that expand another one: KBKnowledgeBaseSNC



KBKnowledgeBaseSNC is 100 lines of code, but no function setUniqueLegacyInfoMessage is defined there.


But this class extends another Script Include: KBCommon, that itself point to KBCommonSNC that is 300 additional line of code.



Inside it also use SNC.knowledgeHelper that I was not able to find.



In KBCommonSNC the message from the Workflow State are defined, but I did not find anything useful to display a new one.


Capture d


I tried to use a setUniqueInfoMessage function without visible result on the kb_view.dopage (but it display on the form)


Capture d


jeremyduffy
Kilo Guru

Did you ever get an answer? I need the same thing for a fairly similar reason.