- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2015 12:14 PM
I have a large list of knowledge base files that require the same modification in each (appending something to an href tag).
Is there a way to mass edit this specific list?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2015 11:27 AM
Hi Joseph,
The best way to do this would probably be to write a GlideRecord query to update your records. The Knowledge base's table name is "kb_knowledge". First you'd write a GlideRecord query that "grabs" all of your intended records, then search thru the "text" field using a pattern find/replace methodology such as a JavaScript Regex. Please review these articles:
wiki.servicenow.com/?title=GlideRecord
wiki.service-now.com/index.php?title=GlideRecord#Query_Methods
If you are on a version prior to Eureka Patch 5 you will need to use the ServiceNow Regex API:
http://wiki.servicenow.com/index.php?title=SNC_Regex_API
If after Eur Patch 5, just use standard JavaScript regex:
http://www.w3schools.com/jsref/jsref_obj_regexp.asp
An example would be something like:
var myKbs = new GlideRecord('kb_knowledge');
myKbs.addQuery('active',true);
myKbs.addQuery('sys_created_on', ">", "2014-01-19 04:05:00");
myKbs.query();
while (myKbs.next()) {
//do something here possibly using a REGEX to find your "href=" string and append a string to it
//update using myKbs.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2020 03:47 PM
Randall, click the "ServiceNow Support" link at the bottom of this page and submit this as a ticket to the HI Service Portal.
If you are not able to submit on behalf of your company, you'll need your Admins to do it for you.
Reference in your ticket that you've already seen this posted in this thread (give 'em the link) so they know it's an important issue for many of us.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 10:37 PM
So I know this was 6 months ago, but I figured out a way to do this myself and I guess it's a sort of... cheating.
(1) Export the affected articles to XML
(2) Perform a search/replace on the XML file
Obviously your search terms can't intersect any XML tags. But if it's general text you should be fine. For example, suppose "Stumptown University" appears in your KB articles, and you want to replace it with "University of Stumptown". You could use a command line stream editor like "sed":
sed s/Stumptown University/University of Stumptown/gI; < original.xml > new.xml
then Import XML the modified XML back into the knowledge base.
s stands for substitute
g stands for global (means it searches the entire file, it doesn't just stop after the first match)
I stands for case Insensitive (it will replace StumpTown University and Stumptown university, etc)
The nice thing about this method is that you can do LOTS of search/replace pairs in one go by putting them into a file:
sed_spec.txt:
s/search1/replace1/gI;
s/search2/replace2/gI;
s/search3/replace3/gI;
then
sed -f sed_spec.txt < original.xml > new.xml

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2020 07:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2023 09:45 AM
This is the most basic need for a Knowledge Base. Why this is STILL not part of the functionality is baffling.
We had requested this in the past, but it was ultimately closed.
Knowledge Workers have still been asking for the ability to easily Search and Replace specific text in many Knowledge articles, perhaps even across different, specific Knowledge Bases.
They’ve stated that something that supported Regular Expressions would be outstanding.
This Find/Replace "function" is something that is very important, and often used with Knowledge.
Many times a Group, Product, or Escalation that is linked or referenced in multiple articles needs to be changed quickly for a Project. Many articles are written containing similar words, and those words often need to change in large sets across many articles across many KBs.
The turnaround time needs to be fast, and it often occurs on "greater than 20 articles", so makes manual editing and pushing through the workflows a tedious process.
Having a script that we can run that finds the subset of articles on specific Knowledge Bases and makes the change in multiples is a huge win and was part of my prior KM tool's standard functionality.
EXAMPLE:
Select Knowledge Bases X, Y, and G
AND/OR Select articles KB0012345-KB0012355
AND/OR Select articles with Knowledge Category "Microsoft Applications"
AND Find "X-word or string", replace with "Y-word or string" (I don’t have a regex example)
Add a note that "X change" was made by system, requested by "user x"
This functionality needs to be Administrated by KB Admins, but usable by ANY KB Contributor, and actions must be fully logged, in case they need to be reversed or "researched".
Please continue developing the concept so we can use it when this comes up again... it surely will.