Help: How to bulk update the run this script for all

Joshua Comeau
Kilo Sage

I placed the wrong sysid in the following script for 300+ scheduled jobs and need to bulk update it

Like excel replace and find tool

 

is their a script I can use so I can query search those jobs and replace the sys id?

 

Script below need to replace 136cdab01b50311070fb4002dd4bcb24 with another sys id

 

try{ //DO NOT TOUCH
 
var cartId = GlideGuid.generate(null); //CartID Generates //DO NOT TOUCH
var cart = new Cart(cartId); //Creates New Cart //DO NOT TOUCH
//add your requested item to the cart by sys_id of the catalog item //DO NOT TOUCH
var item = cart.addItem('136cdab01b50311070fb4002dd4bcb24', 1); //Adds Facility Request Catalog //DO NOT TOUCH
 
 
//Facility Scheduler STARTS HERE:)
 
//Only fill out inside the quotations 
//Short Description 🙂
cart.setVariable(item, 'what_can_we_help_you_with', "3 Year Building Inspection - Parking Garage"); 
 
//Facility Scheduler STOPS HERE:)
 
var rc = cart.placeOrder(); //Places Order //DO NOT TOUCH
gs.info(rc.number); //DO NOT TOUCH
}//DO NOT TOUCH
catch(ex){//DO NOT TOUCH
gs.info(ex);//DO NOT TOUCH
}//DO NOT TOUCH
//end
1 ACCEPTED SOLUTION

Joshua Comeau
Kilo Sage

Found out you can export xml and then open in wordpad and then replace all and then just import it back into servicenow thanks though!

View solution in original post

2 REPLIES 2

Meloper
Kilo Sage

So in all 300+ Script it is SysID= 136cdab01b50311070fb4002dd4bcb24
and in all 300+  you have to replace it with another but same SysID for all Scripts?
Please be aware that you have to push them also in an Update Set Manual.
Maybe you can also Use a fix script and uncheck the checkbox: Unloadable

YOu can use indexof or create a Small RegEx:
Solved: Regular expression to extract a sys_id - ServiceNow Community

 

Joshua Comeau
Kilo Sage

Found out you can export xml and then open in wordpad and then replace all and then just import it back into servicenow thanks though!