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

How to make mass update in KB Article?

Lalitha6
Kilo Explorer

Hi,

We have a requirement regarding KB Article.

Need to replace an old URL to new URL. The old URL is present in the content of the article not in field.

Note :

There are 215 KB Articles are present. So we need to mass update all the articles.

 

Please provide me any suggestions or idea regarding this as soon as possible

 

Thanks

Lalitha

3 REPLIES 3

FIKRI BENBRAHIM
Kilo Guru

Hello Lalitha,

 

   You can use this article which provides steps to do bulk/mass updates on records: https://community.servicenow.com/community?id=community_blog&sys_id=60ccee25dbd0dbc01dcaf3231f961946.

   Hit helpful or correct if it solves your issue.  

 

Regards

 

sachin_namjoshi
Kilo Patron
Kilo Patron

You can write fix script to mass update URL is content of KB article.

You will have to use regex to update URL in text of knowledge article.

 

 

Regards,

Sachin

DScroggins
Kilo Sage

Hi Lalitha,

 

The below script will find and update all of the articles with the correct URL:

 

var srcStr = oldURL; //Replace with url you want to replace
var fxdStr = newURL; //Replace with new url
var r = new GlideRecord('kb_knowledge');
r.addQuery('text','CONTAINS',srcStr);
r.query();
while(r.next()){

  var txt = r.text.toString();
  var fixed = txt.replace(srcStr,fxdStr);
  r.text = fixed;
  r.setWorkflow(false);
  r.update();
  
}