KMSCCoreImport utility

The utility KMSCCoreImport imports data from the core table in Service Manager to the kmdocument table in the Knowledge Management application. This import migrates the IRExpert knowledge documents from previous versions of ServiceCenter. By importing data from the core table used by IRExpert, you make the data available to the Knowledge Management application.

The KMSCCoreImport utility is for a one-time transfer of all files from the core table into the Knowledge Management application. If you run this code more than once, it imports duplicate data into the Knowledge Management application.

You can edit KMSCCoreImport utility script to take into account any customizations of either the core table or the data contained in the core table. The areas in the KMSCCoreImport script where changes are allowed and expected are clearly marked. Also, those sections of the code that cannot be changed are also commented accordingly.

Tips for using the KMSCCoreImport script

Before you use the KMSCCoreImport script, consider the following:

  • Back up the database before you run the script against the database.
  • Rename the script to create a copy and then add the copy to the ScriptLibrary before you begin modifying the script.
  • Run the modified script against a copy of your database to verify that the script works correctly.
  • Run the complete script in a test environment to verify the script and the resulting records.

Modifying the KMSCCoreImport script file

Before running the import script, you should modify the KMSCCoreImport script to support any customizations or modifications to the core table.

To modify the KMSCCoreImport script, find the section of the script file that begins with the comment "this is the section of the customized code where additional code should be added ..." then follow the instructions provided by these comments. Essentially, you need to map any fields added to the out-of-box core table and update the field names.

The following is a sample:

//????????????????????????????????????????????????????????????????
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//this is the section of the customized code where additional code
//should be added if the user so desires...the following are a few
//example lines of code
//NOTE: if a field name has a dot delimiter such as in entry.id, in
//javascript it has to be changed to an underscore as in
// entry_id...you can see another //example of this in the example
//code below
//newKMDoc.reference = corerecs.description + " " +
//corerecs.mycustom_field;
//newKMDoc.doctype = corerecs.mycustomdoctype;
//if the customizations to the core table include fields that do
//not directly translate to any fields in the default kmdocument
//table, and yet the user still wants to maintain that data,
//they should follow the instructions in the user guide for how
//to add a new field to the kmdocument table (WARNING: this is
//a very serious and involved task so be sure you know what you
//are doing before taking this step - it is advised that only
//admin users perform any sort //of changes like this). Once the
//new field has been added to the kmdocument table, you can use
//lines like the following example:
//newKMDoc.mynewcustomfield = corerecs.myothercustomizedfield;
//PLEASE NOTE however the caveat that adding new customized fields
//to the kmdocument table impacts many different aspects of the
//program that MUST be considered such as the searching and
//document type/document view structure(s) that represent the raw
//data in end user form...as well as the forms used to edit the
//documents once they have been imported...all of these areas must
//also be considered before making any changes...
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
If you want to create document categories that match the document categories used in IRExpert, see the section of the script that begins:
//in the default setup, the category and subcat fields of the core //table appear not to be used so we will just shove all core //records into a single category within //KM - Service Manager/KM/CoreImport var newcat = system.library.KMCategory.getCategoryIdString ("Service Manager/Knowledge Management/CoreImport", true); newKMDoc.categories[0] = newcat; newKMDoc.generatedcats[0] = "Service Manager/Knowledge Management/CoreImport"; //if however, the cat and subcat fields are used and the user //would like to use them for categorization, then comment out the //three lines above and remove the commenting before the next //lines var newcat = system.library.KMCategory.getCategoryIdString (corerecs.category+"/"+corerecs.subcategory, true); //newKMDoc.categories[0] = newcat; //newKMDoc.generatedcats[0] = corerecs.category+"/"+corerecs.subcategory;
//in the core table, the description and resolution fields are //arrays of strings so we have to cycle through them and put them //together to get our question and answer fields' values //respectively.

Running the KMSCCoreImport script

Run the KMSCCoreImport script from Service Manager. You can use either the command line ( sl) or click Tailoring > Script Library to access and run the script.

To run the KMSCCoreImport script:

  1. Locate the importCoreToKMNow function in the script. It is the single line of code at the bottom of the script that calls the single function in the script file.
  2. If the import is based on the out–of–box core table data then the parameter value for this call should be true. This creates records of the Problem / Solution type.
    importCoreToKMNow(true);
  3. If the import is based on customized core table data then the parameter value should be false.
    importCoreToKMNow(false);
  4. With this parameter change, you can modify the document type to match a customized document type. In the script, find the second occurrence of the line:
    newKMDoc.doctype = "howto".
    Change the doctype to match the name of your customized document type.
  5. If you change the value of the parameter and update the doctype, save the file before continuing.
  6. Click Execute. The script runs. You are notified when the process completes with the message, "The import from the core table is complete".