How to change the prefix of existing knowledge articles (KB)?

trout1974
Kilo Guru

How can I change the prefix on existing KBs within a knowledge base, and then of course new kbs created will have the new prefix?

I would presume there is someway to run a script or something along those lines.. I am not a developer, I have dabbled a little bit, I am a Knowledge Manager who likes to get the whole idea together before I present it. Any help you can provide is greatly appreciated. 

In the end.. the plan is to remove the existing default prefix "KB" and update it to another prefix, and update all the existing KBs within the knowledge base also, without breaking any of the existing permalinks. 

Thank you again, 

2 ACCEPTED SOLUTIONS

@trout1974 to update prefix of existing records, you can create a fix script then execute it.
Here is an example of fix script:

var existingKB = new GlideRecord('kb_knowledge');
existingKB.setLimit(1);
existingKB.query();
while(existingKB.next()){
existingKB.number = changePrefix("KB", "KNOW", existingKB.number);
existingKB.update();
}
function changePrefix(oldPrefix, newPrefix, number){
var x = number.split(oldPrefix);
return newPrefix+ x[1];
}

View solution in original post

@trout1974 unfortunately, the permalink is related to the number of the KB.
So the update of the number will break the existing permalink.

I don't have simple solution in mind to preserve the existing permalinks (related to the old prefix)


View solution in original post

6 REPLIES 6

In the previous script, note that:

  • I assume that the new prefix is "KNOW"
  • The second line with setLimit syntax limit execution to a single record. (deleted this line will update the prefix of all existing KB)

Thank you, I don't need it perfect, I just needed a bump in the right direction, I will pass this info along with my pitch and see if they will accept the change. Thank you again.