Import a knowledge base from static html files

poornima2
Mega Expert

We would like to import an existing KB article we have saved locally as an HTML file to the Service-Now server and create a new KB.
I was provided a script which is in the wiki (http://wiki.service-now.com/index.php?title=Useful_Scripts#Import_a_knowledge_base_from_static_html_files_.26_rename_all_image_tags). This script is supposed to enable uploading of HTML files(including images) to the KB.
My problem is,i can able to upload the file into the KB,but the images are not visible in the KB article
(The images within the articles are not uploading).If anyone else has had success with such an operation, please let us know.

Thanks.

22 REPLIES 22

ethal
Kilo Contributor

Hi,

Thank you Marc for following up with this issue. We have been trying to utilize this aspect of the ITSM suite for a long time (over 3 years). We have a few questions regarding the process you described:

- When you say we will need to get some SNC resources, does that mean technical support or professional services?
- Could you please clarify what you mean when you say we need SNC OPS access?
- Regarding the " /scs/" folder - is that a folder we need to create on a local machine from which we will be uploading the files or is this a folder we need to create on an SNC server?
- When we ran the scheduled job to upload the files, as described in your most recent post, we encountered the following error within the sys log:

org.mozilla.javascript.EcmaError: [JavaPackage java.io.FileReader] is not a function.
Caused by error in at line 36

33: return;
34: if (!file.isFile())
35: return;
==> 36: var fileReader = new java.io.FileReader(file);
37: var reader = new java.io.BufferedReader(fileReader);
38: var l = null;
39: var total = "";

Might you be able to determine the cause of this error?

The tool you referenced is very helpful!

Thanks!


CapaJC
ServiceNow Employee
ServiceNow Employee

I think I can address at least a couple of these, tho not the rest.

"SNC resources" almost surely means Professional Services, since this isn't something with which Customer Support has experience, and isn't something that can yet be officially supported.

"new java.io.FileReader" used to work but doesn't anymore. Java classes must be called with Packages call, e.g., "new Packages.java.io.FileReader", but I'm not sure we even allow access to java.io classes anymore.


marcguy
ServiceNow Employee
ServiceNow Employee

- When you say we will need to get some SNC resources, does that mean technical support or professional services?
Yes, when I was saying SNC Resources, I did mean someone from Services, (which in this case was myself)

- Could you please clarify what you mean when you say we need SNC OPS access?
(Because only OPS have access to the back-end databases, I had to have those images uploaded to an /uploads folder which lives on every instance, you could do this manually through the UI but if you have a lot of images, that would be very time-consuming'

- Regarding the " /scs/" folder - is that a folder we need to create on a local machine from which we will be uploading the files or is this a folder we need to create on an SNC server?
'The /scs/ folder is already on an instance, it's more of a shortcut to the 'uploads' folder rather than an actual folder, but if your html filters reference /scs then any images uploaded to the 'uploads' folder will work.

- When we ran the scheduled job to upload the files, as described in your most recent post, we encountered the following error within the sys log:
As James says, those commands will no longer work on newer instances, that's why I had to import the KB articles to an older instance, then export them via XML.

thanks,
Marc


Is there any purpose in leaving the Import to the Knowledge Base script up? Since the java.io.File command was locked down, it seems like a useless script for customers.

Yours,

Guy Yedwab
Documentation


ethal
Kilo Contributor

Regarding the scheduled job, are you saying this procedure will not work on a newer version? Would we need to perform part of the procedure on an old instance, then complete on a new instance? (as you described)