Map imported HTML to Source Code in Knowledge?

regftw
Kilo Contributor

We have X amount of articles to import into our system, we want to achieve the data import using a transform map, but we can only map to say the "Text" field in terms of displaying data.

Our issue is the data is already in HTML format, with tags, is there any way to map the html to the "source code" function?

As a bonus, using the new category picker, how does one map to X category, 4 trees down the category picker?

Thanks,

Roland

5 REPLIES 5

Mwatkins
ServiceNow Employee
ServiceNow Employee

Have you tried it Roland? The kb_knowledge.text field stores raw HTML so it should take your imported data as-is. The value you see on the screen when editing a KB article in ServiceNow is the interpreted HTML using a WYSIWYG editor, but the underlying field stores the values as HTML.



Regarding the new category picker, as long as your categories are set up already and there are no duplicate category names you ought to be able to do a normal reference match against the name of the category. The kb_knowledge.category field is just a reference field pointing to records in the kb_category table. The depth level is achieved by the kb_category.parent_id field. So, in other words, you don't need to tell the system that the category you want is 4 levels down, you just need to give it the right name. However, if you have duplicate category labels in different hierarchies then that could be a problem as the import would arbitrarily match one or the other duplicate category that exists in the system. I think for that you could do something like a scripted field mapping where you include the full hierarchy of the category as a single string and then break it apart and use a script to find the correct matching target category. So the category would be supplied to ServiceNow like "level1.level2.level3" and the script would do categoryArray = current.split(".");


regftw
Kilo Contributor

Matthew,



Thanks for your reply. I attempted to copy paste some html and it spit it back out as plain text on the article, html tags and all..


example:


<html>
<head>


</head>


<body>


Something.


</body>


</html>


Mwatkins
ServiceNow Employee
ServiceNow Employee

Where did you copy/paste the HTML? You mean into the kb_knowledge.text field through the normal WYSIWYG editor or somewhere else?


regftw
Kilo Contributor

yeah the normal WYSIWYG, editor. does it only map properly by use of an import and mapping to the field?