How to execute a fix script from scheduled job?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 06:42 AM
Hi,
I calling a script include from scheduled job, but some records are not getting updated.
I am thinking its due to huge data, there are around 4 lakh records and some are not being updated.
So, I am planning to create a fix script and execute it from schedule job for every 6 hours.
Below is the script in scheduled job:
var gr = new GlideRecord('sn_vul_vulnerable_item');
gr.addActiveQuery();
gr.query();
while(gr.next()){
var securityCalc = new sn_vul.VulnerabilityCalculator(gr, true, true, "sn_vul_calculator_group", "sn_vul_calculator");
securityCalc.calculate();
}
I want to move this code to fix script and execute it every 6 hours, please help me with the syntax for this.
Thanks in advance.
- Labels:
-
Cost Management (ITSM)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 06:57 AM
Why do you believe the scheduled job has a time limit?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 06:59 AM
because some records are left without getting updated, when I tried fix script they got updated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 10:22 AM
Hello Rambo,
Go through this link. This should help you to solve the problem.
Mark the comment as a correct answer and helpful if it helps to solve the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2024 08:51 AM
Hi @rambo1
Kindly use below code in schedule job
(function(){
var fixScript = new GlideRecord('sys_script_fix');
fixScript.addQuery('name','fix_script_name');
fixScript.query();
if(fixScript.next()){
eval(fixScript.script);
}
})();
Hope this helps !
Kindly mark helpful/accepted if assists.
Thank you!