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: