Skip to content

Commit 37ae92b

Browse files
authored
Create run-scheduled-job.js
Adding the code
1 parent 24eff5f commit 37ae92b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Generic/parent scheduled job table = sysauto
2+
var grScheduledJob = new GlideRecord("sysauto");
3+
if (grScheduledJob.get(sys_id)) {
4+
// In order to run the job successfully, we need the more specific
5+
// child table name of the scheduled job (eg. sysauto_script)
6+
var classname = grScheduledJob.getValue('sys_class_name');
7+
var scheduledJob = new GlideRecord(classname);
8+
if (scheduledJob.get(sys_id))
9+
gs.executeNow(scheduledJob);
10+
}

0 commit comments

Comments
 (0)