KMDocumentExport utility

The KMDocumentExport utility is a knowledge document export tool to achieve the article migration from Service Manager to Service Anywhere. You can use this utility to export knowledge documents from Service Manager to a pre-defined directory in the following formats:

  • A metadata.xml file – shows all meta information of an article including the title, status, category, create time, last modify time, attachment, and links between articles, etc.
  • An articles folder – contains html files that shows other information of an article except the meta information.
  • A resources folder – includes all embedded images and attachment files.

For more information about how to import the knowledge documents which are exported from Service Manager to Service Anywhere, refer to the following links in the Service Anywhere help server:

Packaging and importing knowledge articles

How to import knowledge article packages

 

Running the KMDocumentExport script

Follow these steps to run the KMDocumentExport script:

  1. Log on to Service Manager as a system administrator.
  2. Type sl in the Service Manager command line field, and then press Enter. Alternatively, you can click Tailoring > Script Library.
  3. Type KMDocumentExport in the Name field, and then click Search.

  4. (Optional) Create the exporting view for each document type so that the KM articles can be exported with these views in the next step. Follow these steps:

    Note The exporting view created in this step duplicates with the existing view that owns the highest security level. However, you are recommended to perform this step especially when you have added new columns to the kmdocument table. If you do not perform this step, the Migration tool only exports KM articles with the default format and the OOB fields.

    1. Uncomment the //copyDocTypeTemplateViews(); line, and then save your modifications.

    2. Click Execute to create the new Auto Created View for KM Export template view which is used to export the KM articles for each document type.

    3. When the copy process is complete, the system displays the following message.

    4. Click Knowledge Management > Configuration > Document Types, and update the newly created Auto Created View for KM Export view as follows:

      1. Remove the highlighted sections (such as title, km id, doctype, summary, creation date, and so on). Keep the knowledge content left.

      2. Click OK to return to the Manage Document Types page, and then click Save to save your modifications. The modified template view is displayed as illustrated follows.

    5. Continue to follow step i and step ii to modify other document type views for KM exporting as necessary.

  5. Comment out the copyDocTypeTemplateViews(); line if it is uncommented in step 4.
  6. Uncomment the //doExport(path, hasView, exportStatus); line, and then change its arguments by following the descriptions below:

    • path: Set the directory for storing the output files in this argument. For example, C:\\ KMDoumentExport is for the Windows server, and /home/KMDoumentExport is for Linux.

      Note Make sure the export path is located in the Service Manager server.

    • hasView: Set this argument to true if you have run copyDocTypeTemplateViews() and modified the exporting views manually. Otherwise, set this argument to false. You can also ignore this argument and the default value is false.

    • exportStatus: Set this argument to a valid KM status value (such as draft, internal, or external) so that the KMDocumentExport script only exports the specified KM articles. You can also ignore this argument and the tool exports all KM articles.

  7. Save your modifications, and then click Execute to start the exporting process.

  8. When the exporting process is completed, the system displays the following messages as illustrated below.

    You can check the exported files in the export directory.

    Note The metadata.xml file is overwritten with the latest results after each exporting. However, the files created by previous exporting in both the articles folder and the resources folder are not removed during the next exporting process. To keep your exporting data contains the latest articles and resources only, you need to use a new export path and folder each time. If your KM article has no content or has no content in the exporting view, the exported article detail .html file displays the There is no content for this KM Article. sentence only.

  9. Follow these steps to remove the exporting views created in copyDocTypeTemplateViews():

    1. Uncomment the //deleteTemplateViews(); line, save your modification and then click Execute to remove the exporting views.

    2. When the removal process is completed, the system displays the following message as illustrated below:

 

Troubleshooting

This topic lists the troubleshooting topics for the KMDocumentExport utility.

Cannot find KM articles in the expected directory

Possible causes:

  • KM articles are exported in the Service Manager server side instead of the client side.
  • The path argument in doExport(path, hasView, exportStatus) is incorrect.

    For example, if the path argument is entered as C:\Work\KMExport for the Windows server, you cannot find the exported articles in the expected directory because the correct format is C:\\Work\\KMExport.

Solution:

Find the exported articles in the <SM_install_location>\Server\RUN directory.

The article count in metadata.xml is inconsistent with that in the articles folder

Possible cause:

The metadata.xml file is overwritten with the latest results after each exporting. However, the files created by previous exporting in both the articles folder and the resources folder are not removed during the next exporting process. This may cause the article count inconsistency issue when comparing the article count in metadata.xml with that in the articles folder.

Solution:

Use a new export path and a new folder each time.

Customized fields cannot be exported to KM articles

Possible cause I:

The hasView argument in doExport(path, hasView, exportStatus) is set to false.

If the hasView argument is set to false, only OOB article content fields (such as problem, solution, question, answer, error, cause, fix, summary, and reference) can be exported, whereas other customized fields cannot be exported.

Solution:

Use the exporting view if any customized fields need to be exported.

Possible cause II:

The hasView argument in doExport(path, hasView, exportStatus) is set to true, but the template view lacks some customized fields.

Solution:

Check the Auto Created View for KM Export view of the corresponding kmdoc type to make sure that all content fields to be exported are defined in this view.

The exported article displays the “There is no content for this KM Article.” message

Possible cause I:

The hasView argument in doExport(path, hasView, exportStatus) is set to false, whereas the OOB article content fields (such as problem, solution, question, answer, error, cause, fix, summary, reference) are all empty.

Solution:

Use the exporting view to export KM articles.

Possible cause II:

The hasView argument in doExport(path, hasView, exportStatus) is set to true, whereas the fields defined in template view are empty.

Solution:

Check the Auto Created View for KM Export view of the corresponding kmdoc type to make sure that all content fields to be exported are defined in the view.