How to execute a fix script from scheduled job?

rambo1
Tera Guru

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.

8 REPLIES 8

Mark Roethof
Tera Patron
Tera Patron

Hi there,

What is the reason for moving this code to a Fix Script? I mean, the code is the same, and the Scheduled Job can easily be scheduled to run for a certain time / at certain moments?

Can you explain the why or what the issue is you are having when staying on Scheduled Jobs?

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

LinkedIn

Hi mark,

scheduled job is not updating few records, I feel its getting timed out and leaving some records.

If there is such behavior, that won't change by changing from scheduled job to fix script.

Investigate if and why your are experiencing this. 

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

LinkedIn

but fix script has no time limit I guess, it will run till all records are update .