- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 10:42 PM
I am trying to launch scheduled job from Background Script and it does not work. The script I am using is
var gr_micro = new GlideRecord('sysauto');
gr_micro.get('93bbb322871e521024530fa90cbb3524');
SncTriggerSynchronizer.executeNow(gr_micro);The error that I am getting is shown in the following image:
Can anybody help me? I have checked that the sys_id is correct, so the record is correctly found.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 10:48 PM
Hi @jordimsant
Ensure you are logged in as a user with the admin role and that the instance allows background script execution of such operations.
correct format :-
var gr_micro = new GlideRecord('sysauto');
if (gr_micro.get('93bbb322871e521024530fa90cbb3524')) {
if (gr_micro.active) {
gs.print("Found scheduled job. Executing now...");
SncTriggerSynchronizer.executeNow(gr_micro);
} else {
gs.print("Scheduled job is inactive. Activate it before execution.");
}
} else {
gs.print("Scheduled job not found.");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 10:48 PM
Hi @jordimsant
Ensure you are logged in as a user with the admin role and that the instance allows background script execution of such operations.
correct format :-
var gr_micro = new GlideRecord('sysauto');
if (gr_micro.get('93bbb322871e521024530fa90cbb3524')) {
if (gr_micro.active) {
gs.print("Found scheduled job. Executing now...");
SncTriggerSynchronizer.executeNow(gr_micro);
} else {
gs.print("Scheduled job is inactive. Activate it before execution.");
}
} else {
gs.print("Scheduled job not found.");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 10:50 PM
Thank you for your help! The problem was the "Run as" field, I suppose that the previous user has not the rights to execute the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 10:49 PM
var gr_micro = new GlideRecord('sysauto_script');
gr_micro.get('93bbb322871e521024530fa90cbb3524');
SncTriggerSynchronizer.executeNow(gr_micro);