Schedule job is not running.

Sriraj V
Tera Contributor

Hi All,

 

There's a oob scheduled job "Add Manager Hub user role" is not running. I tried running that script in on-demand, still its not running. What could be the reason.?

I kept run as system administrator and also empty as well. Still no luck.

Kindly help me with this.

 

Regards,

Sri

9 REPLIES 9

Weird
Mega Sage

I don't have that scheduled job, but you can just add logs into it and see if it runs through.
On first line add log gs.info("Starting Scheduled job "Add Manager Hub user role"); and on the last line gs.info("Finishing Scheduled job "Add Manager Hub user role");


If you get both logs you know its running but something in between prevents it from changing anything and you'd need to make sure everything is OK.

If you run it in a background script you can see the logs right away and if there are any issues with the code itself.

Sriraj V
Tera Contributor

Hi @Weird ,

Thank you for the response. I have already did the same, I have commented the code part (which calls a script include) and kept just logs. 

Still i am unable to see the log entries in the system.

 

Regards,

Sri

Did you run it in a background script?
Usually if it does nothing and doesn't log it means that the code fails. This can happen when Servicenow has failed to install a related component. Background script should indicate this somehow.

For example with the "Homepage Deprecation Tool" a older version had a flow with a script in it. The script called some script include function that didn't exist in the system. A later version of the tool included that function.

I figured it out when I manually tried to call the script include and its function in a background script and it returned undefined function etc when I tried to log the return value.

Sriraj V
Tera Contributor

Function of that schedule job will call a script inlcude, so i tried calling script include in a fix script it worked.

 

Case 1 : I have commented, the coding part and just kept logs. Logs should execute right..?

Case 2 : I created another test script with only one logs as shown below, this logs is also not recorded. My query is do we have any restrictions for running schedule jobs in scope apps..? @Weird 

 

SrirajV_0-1684306875021.png

 

 

Regards,

Sri