Use Knowledge V3 Category Lookup on other tables

In your Geneva instance you might want to create a New Table (Knowledge Approvers) with the fields Knowledge Base (Ref: kb_knowledge_base) and Category (Ref: kb_category). When choosing a new Category, the same Category Picker should appear like in the KB Article Form. So, same behaviour on KB Category Lookup but in another table:CategoryPicker

To accomplish this, you have to copy and modify the following:

  1. Copy UI Macro “kb_category_reference_lookup” and rename
  2. Copy UI Page “kb_categories_dialog” and rename.
  3. Copy UI Script “jquery_columnview” NOTE: It’s protected and read-only, so do NOT use Insert and Stay
  4. Add the following attribute in the Dictionary of the Category field:

field_decorations=<name of your modified UI Macro>

After the renaming you need to adapt them like:

  1. UI Macro:

    – In the function “openDialog” adapt:

       var kb_knowledge_base = g_form.getValue(‘<your field referenced to kb_knowledge_base>‘);

       var kb_knowledge_base_gr = g_form.getReference(‘<your field referenced to kb_knowledge_base>‘);


       var dialog = new GlideDialogWindow(‘<your ui page name>‘);

    – In “$j(function($)” adapt:

         var category_form_id = ‘element.’ + ‘$[jvar_table_name]’ + ‘.<your field referenced to kb_category>‘;

         var category_link_id = ‘a[id=”lookup.’ + ‘$[jvar_table_name]’ + ‘.<your field referenced to kb_category>“]’;

     – Not necessary but if you want you can correct the misspelling of the comment in the end of the script:

       //override of deafault onclick event will happen only for one selector that exixt on the page

  1. UI Page:

    – In HTML on Line 3: <g:include_script src=”<your ui script name>“/>

    – In Client Script:

         – In function “setCategory”:  

                g_form.setValue(‘<your field referenced to kb_category>‘, id);

          – In “$j(function()”:

                var kbCategoryId = g_form.getTableName() + ‘.<your field referenced to kb_category>‘;

                 => in .bind({  …

                 columnview_create: function(ev, obj)


                 columnview_update: function(ev, obj)

                 are not needed so you can comment them out or delete them

  1. UI Script:

     ~ Line 181:

         // hijack ok/cancel button event handlers.

        var $okBtn = $j(‘#body_<name of your modified UI Page> .btn.btn-primary.category-ok-btn’);


        var $cancelBtn = $j(‘#body_<name of your modified UI Page> .btn.btn-default’);        

     ~ Line 369:       

        function disableOkCancel() {

              $j(‘#body_<name of your modified UI Page> .btn.btn-primary.category-ok-btn’).attr(‘disabled’, true);

              $j(‘#body_<name of your modified UI Page> .btn.btn-default’).attr(‘disabled’, true);


Robert Blotny
Robert works as Technical Consultant at Fruition Partners (ex-Aspediens) since 2013. He is certified System Administrator and Implementation Specialist. With great dedication and technical expertise he supports customers throughout their Service Transformation. His motto: Always give your best.
Recent Posts
Showing 2 comments
  • Steve

    Thank you so much!!
    Have been trying to work out how to add the category picker to the category field on a KB Submission form – worked perfectly.

  • Mark

    Thanks a bunch. This not only helped me solve my problem but also helped me better understand how these things work in ServiceNow.

Leave a Comment

Start typing and press Enter to search