ServiceNow supports importing Microsoft Word documents out of the box via their "Import Knowledge" feature. Documentation regarding this feature is available here for the Madrid release or here for the New York release. Older and newer versions of this documentation are also available on the ServiceNow product documentation website.
Unfortunately, this process is quite limited, and it wrecks formatting far more than I'm comfortable with. The goal of this repository is to build out a better (but still repeatable) process for importing Microsoft Word documents. In addition, because this new method relies on pandoc (an amazing free and open source software for converting files between an impressive variety of formats), this methodology should support far more than just Microsoft Word documents.
Important notes:
- This method requires a local password in the ServiceNow instance. This means that SSO accounts are not supported.
- This method does not support Knowledge Management V3 (i.e. version controlled knowledge). It shouldn't be hard to add, though. Feel free to submit a PR.
- This method does not support custom fields. The only fields it sets are the Knowledge Base, Title (Short Description), and Contents (Text). Feel free to fork the repo to add your own custom field support.
- The Windows commands below assume that Python 3 is the only (or default) version of Python installed. I have not validated any of this with Python 2.
First, you'll need to install Python 3 and Git. To accomplish this on Windows, navigate to their respective websites and run the .exe
installers.
Once Python and Git are installed, you can install the following Python modules:
- BeautifulSoup (Python Module)
- pypandoc (Python Module)
- Requests (Python Module)
To do this, run:
Windows (Powershell):
> pip install bs4 pypandoc requests
Linux (Bash):
$ sudo pip3 install bs4 pypandoc requests
Navigate to the directory where you're going to store the git repository:
Windows (Powershell):
> cd C:\Users\Owner\Desktop\Git\
Linux (Bash):
$ cd ~/git
Clone the git repository locally:
$ git clone https://github.com/jack-thomas/servicenow-knowledge-import.git
Create the directory - either from a file browser or the command line, as shown below:
Windows (Powershell):
> cd C:\Users\Owner\Desktop\Git\servicenow-knowledge-import
> mkdir 'Input (Word)'
Linux (Bash):
$ cd ~/git/servicenow-knowledge-import
$ mkdir Input\ \(Word\)/
Add your .docx
files to that directory.
Windows (Powershell):
> cd C:\Users\Owner\Desktop\Git\servicenow-knowledge-import
> python .\convert.py
Linux (Bash):
$ cd ~/git/servicenow-knowledge-import
$ python3 ./convert.py