how to add knowledge icon next to short descrption

swathib
Mega Contributor

I want to add Knowledge icon beside short description on incident form.For this i have tried creating UI Macro and setted the UI macro in "Short description" Attribute field.

But it is not working...

Below is the UI Macro:

<?xml version="1.0" encoding="utf-8" ?>

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<a id="${jvar_n}" onclick="searchKnow()">

<img src="bulb.png" width="17" height="20" title="${gs.getMessage('Search Knowledge')}" alt="${gs.getMessage(Search Knowledge')}"/>

</a>

<script>

function searchKnow() {

    var searchText = g_form.getValue('short_description');

    var url = 'kb_find.do?sysparm_search=' + escape(searchText);

  url += '%26sysparm_nameofstack=kbpop';

  url += '%26sysparm_kb_search_table=incident'; //This example runs on the Incident table. Edit the table name as necessary

  popupOpenStandard(url, "kb2task");

}

</script>

</j:jelly>

Can anyone help me??

6 REPLIES 6

marcguy
ServiceNow Employee
ServiceNow Employee

I normally just add the knowledge_search=true attribute as either the attribute, or the dictionary override attribute for that table:



knowledge_searchtrue/falsestring fieldsIf present or true, causes a knowledge search icon (a small book) to appear next to the field. Clicking this icon launches a pop-up window for searching the knowledge base, unless a custom knowledge search function has been specified (see knowledge_custom).

http://wiki.servicenow.com/index.php?title=Dictionary_Attributes#gsc.tab=0



http://wiki.servicenow.com/index.php?title=Dictionary_Overrides  


Rakesh Mamidi
ServiceNow Employee
ServiceNow Employee

In short description, check if there any dictionary override for incident.


Can you share how the UI macro is setted in short description field?


find_real_file.png


ref_contributions=Knowledge is the UI macro i called in this Attribute


Can you please change the macro name and check ?



It tried with name as "kb" and with same attributes, its working for me.