How to find the issue in Knowledge numbering table

sasipriya
Tera Contributor

Hi Team,

 

    Kindly help me on below issue.

   I am facing an issue in the knowledge table. In the prod instance, we set the knowledge number to 10206, but all the articles were created from 10000 and now the article number has been created up to 10197 after this article directly created 10206 article . how can we fix this issue?

 

Thanks,

Sasipriya.

3 REPLIES 3

Peter Bodelier
Giga Sage

Hi @sasipriya,

 

I'm not sure I get the issue?
Articles where created before you adjusted the number, after adjusting it, numbering went on from the new number. Seems like its doing what it should?


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Sandeep Rajput
Tera Patron
Tera Patron

@sasipriya You can write a fix script to fix the numbers of such articles. Here is one such sample script which could help you to update the existing numbers.

 

var kbArticle = new GlideRecord('kb_knowledge');
kbArticle.addEncodedQuery('numberBETWEENKB0010000@KB0010197');
kbArticle.query();
var kbNumber = 10206;
var count=1;
while(kbArticle.next()){
    var someNum=kbNumber+count;
    kbArticle.setValue('number','KB00'+someNum);
    kbArticle.update();
    count++;
}

Please make sure to run this script in a sandbox instance first, if everything works fine, run this script via a fix script on prod.

 

And keep in mind, KB Versioning might not like this 😉


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.