The Now Platform® Washington DC release is live. Watch now!
‎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.
‎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();
}
‎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();
}
‎01-23-2020 02:54 PM
Does anyone have a fully working example? Even something simple like replacing "hello" with "bonjour" in all KB articles in a KB table would be a helpful start.
‎08-01-2018 05:00 AM
I realize this is a very old thread, but for what it's worth, I have confirmed via a HI ticket that there is no other route than JS/RegEx. An enhancement has been submitted, but it couldn't hurt for others in need to also request this feature!
‎12-05-2019 01:52 PM
We have the same need, also.
I'm new to this. How would I go about requesting the feature?