The CreatorCon Call for Content is officially open! Get started here.

Bulk KB Article and Version Loading into ServiceNow

RajuSattims
Tera Contributor

Hello Team,


We need to load a bulk of KB articles into ServiceNow. Each article has different versions, so I need to load them according to their respective versions. Once the data is loaded, each KB article should be linked to its parent KB article as per the KB article process.
Please let me know if there is a way to load this data into ServiceNow.

3 REPLIES 3

Connectmustaq
Mega Guru

Hi @RajuSattims ,

 

To load bulk KB articles into ServiceNow with multiple versions and link each article to its parent, you can follow these approaches:

Bulk Import of KB Articles with Versions

  • Use the Import Articles feature under Knowledge in ServiceNow for smaller batches. It supports importing Word (.docx) files and handles embedded images as attachments. This is suitable for manual imports but may be tedious for large data sets.

  • For a large number of articles (including multiple versions), use the ServiceNow Table API to automate importing data into the kb_knowledge table. This is a programmatic REST API approach allowing CRUD operations, ideal for importing articles with version details.

  • Ensure your import or API script sets the version number of each article properly in the version field, usually version or kb_version on the kb_knowledge table.

Linking KB Articles to Parent Articles

  • ServiceNow KB articles can be linked by setting the Parent field (parent) on the child article record to the sys_id of the parent article.

  • When importing or creating the articles programmatically, link versions by assigning the correct parent sys_id for each version of a KB article.

  • This parent-child relationship preserves the version history and organizes articles as per your KB process.

Recommended Steps

  1. Prepare your KB articles data with versioning info and parent-child relationships.

  2. For large imports, develop a script or integration that:

    • Creates KB articles via Table API with proper fields.

    • Sets the version number and parent field linking child versions to the main article.

  3. Use the Attachment API if you need to upload attachments/images along with articles.

  4. Validate the imported articles in ServiceNow Knowledge Base module and ensure versions appear correctly linked.

  5. Perform testing on a subset before full bulk import.

References and Tips

  • Refer to ServiceNow documentation on bulk import of knowledge articles and API usage for knowledge articles.

  • Make sure your import respects KB article states and workflows.

  • Use sys_id references from created articles to ensure accurate parent-child linking.

If you want, I can help provide a sample REST API script or JSON payload template to bulk upload KB articles with versions and parent links according to your data.

This approach is the recommended practice for bulk-loading and version linking for KB articles in ServiceNow

You may find below thread helpful:-

If it is helpful, please hit the thumbs button and accept the correct solution by referring to this solution in the future it will be helpful to them.

 

Thanks & Regards,

Mohammed Mustaq Shaik - ServiceNow Consultant - Lets connect on Linkedin:https://www.linkedin.com/in/shaik-mohammed-mustaq-43ab63238/

 

Hello @Connectmustaq,

 

Thank you for the update!

 

Please provide a sample REST API script.

Hi @RajuSattims ,
Here is a sample REST API script using JavaScript (Node.js with axios) to bulk load KB articles into ServiceNow with versioning and parent linking. This sample assumes you have an array of articles, each with a parent reference and version information.
const axios = require('axios');
const instance = 'your_instance'; // e.g. dev12345
const user = 'your_username';
const pass = 'your_password';
// Basic Auth token
const auth = Buffer.from(`${user}:${pass}`).toString('base64');
const kbArticles = [
{
short_description: 'Parent Article Title',
text: 'Content of parent article...',
version: '1.0',
parent_sys_id: null // Parent article has no parent
},
{
short_description: 'Child Article Version 1.1',
text: 'Content of child article version 1.1...',
version: '1.1',
parent_sys_id: 'sys_id_of_parent_article' // insert correct sys_id here
},
// Add more article objects here
];
async function createKbArticle(article) {
try {
const payload = {
short_description: article.short_description,
text: article.text,
version: article.version,
parent: article.parent_sys_id || ''
};

const response = await axios({
method: 'post',
url: `https://${instance}.service-now.com/api/now/table/kb_knowledge`,
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
data: payload
});

console.log(`Created article: ${article.short_description} with sys_id: ${response.data.result.sys_id}`);
return response.data.result.sys_id;
} catch (error) {
console.error(`Error creating article ${article.short_description}:`, error.response ? error.response.data : error.message);
}
}
async function bulkLoadKbArticles() {
for (const article of kbArticles) {
// If parent_sys_id is null, this is a parent article, create it first and update the object with sys_id
if (!article.parent_sys_id) {
const sys_id = await createKbArticle(article);
article.parent_sys_id = sys_id;
console.log(`Updated parent_sys_id for ${article.short_description}: ${sys_id}`);
} else {
// For child articles, create with parent_sys_id already set
await createKbArticle(article);
}
}
}
bulkLoadKbArticles();
 
  • Replace your_instance, your_username, and your_password with your ServiceNow credentials.
  • Populate the kbArticles array with your KB article data ensuring the parent_sys_id is set for versions except the main parent.
  • The script first creates parent articles (where parent_sys_id is null), captures their sys_id, and then uses that as parent_sys_id for their versions.
  • Run this script with Node.js.
This is a basic example for creating articles. You can extend it to add attachments or other fields based on your data model.
 
please mark the answer as correct and helpful based on the impact!!
Kind Regards,
Shaik Mohammed Mustaq