Add Custom Fields to Knowledge Search in HP Service Manager 9.31

Posted by Wally Coates  I  September 9, 13

Let’s say that you would like to add a few custom fields to your knowledge documents within HP Service Manager's Knowledge Management (KM) Module, and then limit KM searches based on the data in those new fields.  How do you do accomplish that?  Let’s take a look.


First, add the new fields to the appropriate dbdicts.  In this example, I will be adding two fields to capture the Affected Service and the Affected CI. Add these two fields to the following dbdicts:

  • kmdocument
  • kmquery

Screens / Formats / Links

Next, you will need to go into all the appropriate kmdocument screens and modify the formats to include the fields you just added.  In my example, I have updated the following formats:

  • kmdocument.errormsg
  • kmdocument.external
  • kmdocument.howto
  • kmdocument.probsol

Example of kmdocument with new fields:

Techport Thirteen provides HP Service Manager consulting services

You can see that the Affected Service and Affected CI fields were added to the form.

And don’t forget to add those fields to your search screen, and subformat as well:

  • kmknowledgebase.knowledgelib.sub

Example of Search format with new fields:

Techport Thirteen can customize your Knowledge Management module within HP Service Manager!

Next, you will want to update the related link record, so the user can select the data for the new fields that you just added, (only if you are adding Find/Fill fields on your format).

Update Knowledge Documents

After adding the fields to the appropriate formats, you will need to add the appropriate data to an existing knowledge document, or create a knowledge document with your new criteria filled in.


The next thing you will need to do is go into the kmmapping table, and add the mapping to the new fields that you have added.  This is mapping the fields from where you are doing your search from, (interactions/incidents/known error, etc) to the kmquery table.


Techport Thirteen can install and configure Knowledge Management in HP Service Manager

Note, the field in the target  side is the JavasSript version of the field name, and must contain underscores “_” and not periods.

You must perform this mapping step for each table/module that you will be performing the knowledge searches from.

Add Fields to Search Script

The next step in this process is to add the new fields to the JavaScript record .  This is where we actually tie in the newly created fields, to the knowledge searching.

You will need to edit the “Knowledge_Library_kmprocesslibcriteria” script record. The example below is referencing an HP SM 9.31 out-of-the-box system.

You will need to go to the function rocessLibCriteria(KMQuery), and add the following to append your new fields to the KMQuery:

if(KMQuery.jms_logical_name != null)
strQuery += " ( " + KMQuery.jms_logical_name + " AND knowledgebase_name: Knowledge_Library)";

if(KMQuery.jms_affected_item != null)
strQuery += " (jms.affected.item: " + KMQuery.jms_affected_item + " AND knowledgebase_name: Knowledge_Library)";

In this example, the two fields that were added to the system were jms.affected.item and

KnowledgeBase Maintenance

Next, you will need to add fields to the knowledgebase maintenance.

From db manager, type kmknowledgebase in the table name, and select the appropriate knowledgebase, for this example, I will choose “Knowledge_Library”. Then, select the Field Definitions tab.

Techport Thirteen provides consulting around best-practice Knowledge Management processes

You need to add your new fields to the bottom of the list. This will add your new fields to the “HitList” and “Doc Body”. Set both of these fields to “true”.

After saving this record, you will need to run a re-index of your knowledge documents so your new fields will be found in the search results.


Make sure you test it all out to ensure that the results you get are based on the new data fields you provided. In my example, I search KM records from an Interaction, so, I will begin filling out a new Interaction:

Techport Thirteen performs application enhancements for HP Service Manager

Make sure you select an Affected Service and CI, that match what you put in your new knowledge document, and select the search icon. Notice my results screen that is returned:

Consulting services for Knowledge Management in HP Service Manager

There is one document in the Knowledge library that matched my criteria.  When I select the document, and then select “Edit”, you will see that my two new fields, Affected Service and Affected CI match what was put in the ticket.

Search results in HP Service Manager's Knowledge Management

Have a comment on what we did, or how we went about it? Would love to hear your thoughts... please post a comment below.

Wally Coates is a Senior Service Consultant for Techport Thirteen within our HP Projects Dvision with over 15 years of HP Service Manager application consulting experience. He collaborated on the above article with peer, Nick King, also a Senior Service Consultant, who works within both our HP Projects and xMatters Projects Divisions.

Tags:  HP Service Manager