KB article movement

ramesham
Tera Contributor

Hi Team,

 

I have been checking this topic from a while but i didn't get the proper solution.

 

I need to move all the knowledge articles from Knowledge base A to Knowledge base B.

Knowledge base B has different set of categories and there more than 200 knowledge articles to be moved.

I can't checkout article individually and make the changes as it captures the versions as well and lot of manual work.

 

Is there any way to move article from KB A to KB B along with their categories.

 

Thanks,

3 REPLIES 3

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Please check the below article and the below post:-

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0852780

 

https://www.servicenow.com/community/now-platform-forum/moving-articles-from-one-knowledge-base-to-a...

 

Please mark my answer as correct based on impact.

Amit Gujarathi
Giga Sage
Giga Sage

HI @ramesham ,
I trust you are doing great.
You can use below script for the same.

// Define the sys_ids of Knowledge Base A and Knowledge Base B
var kbA_sys_id = 'SYS_ID_OF_KB_A';
var kbB_sys_id = 'SYS_ID_OF_KB_B';

// Query all articles from Knowledge Base A
var kbArticleGR = new GlideRecord('kb_knowledge');
kbArticleGR.addQuery('kb_knowledge_base', kbA_sys_id);
kbArticleGR.query();

while (kbArticleGR.next()) {
    // Change the knowledge base to KB B
    kbArticleGR.kb_knowledge_base = kbB_sys_id;
    
    // Map categories from KB A to KB B (this is a simplified example, you might need a more complex mapping logic)
    // For example: kbArticleGR.category = yourMappingFunction(kbArticleGR.category);
    
    // Update the article
    kbArticleGR.update();
}

function yourMappingFunction(category) {
    // Implement your logic to map categories from KB A to KB B
    // Return the mapped category
}

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi