Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Search Knowledge Base for all instances of the subdomain of the Workday URL

Lisa Patten
Mega Contributor

We're moving to the Workday public cloud in the next year, and so all instances of our Workday url will need to be updated. As you can imagine, we have many links to Workday pages within our Knowledge Base in ServiceNow, and we have a large volume of Knowledge Articles in ServiceNow. How can we search all of our knowledge articles for the subdomain portion of our Workday url so that we can plan for the updates needed during the cloud migration project?

Any help would be greatly appreciated!

2 REPLIES 2

Swapna Abburi
Mega Sage
Mega Sage

Hi @Lisa Patten 

You can use either background script or fix script to bulk replace the URL in knowledge articles. Sample script for reference.

 
var oldUrl = "https://old.example.com";
var newUrl = "https://new.example.com";

 

var gr = new GlideRecord('kb_knowledge');
gr.addEncodedQuery('workflow_state=published'); //update query
gr.query();
while (gr.next()) {
    var originalText = gr.text.toString(); //Article body. depends on article template, the field may vary

 

    // Check if the old URL exists in the text
    if (originalText.indexOf(oldUrl) !== -1) {
        var updatedText = originalText.replaceAll(oldUrl, newUrl);
        gr.text = updatedText;
        gr.update();
    }
}

This is great news, thank you so much!