Scheduled job is not running automatically, Every time i am executing manually.

subbarayudu
Tera Contributor

I want to run the scheduled job automatically but is not doing, every time i have to click execute now button.

Could you let me know the reason why it is behaving it and how to correct it.

 I have created this in scoped application  because third party risk management is the scoped application.

subbarayudu_0-1723044184043.png

var issueGr = new GlideRecord('sn_vdr_risk_asmt_issue');
issueGr.addEncodedQuery('stateNOT IN3,4,7^u_date_identifiedISNOTEMPTY');
issueGr.query();
while (issueGr.next()) {
    var idt1 = new GlideDateTime(issueGr.u_date_identified);
    var idt2 = new GlideDateTime();
    var difference = GlideDateTime.subtract(idt1, idt2);
    days = difference.getDayPart();
    issueGr.u_issue_age_days = days;
    issueGr.update();
}

 

16 REPLIES 16

SN_Learn
Kilo Patron
Kilo Patron

Hi @subbarayudu ,

 

Did you check if the gs.info logs are showing or not when it is running on scheduled time?

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

@SN_Learn I have used gs.info and showing the info msg  when it is running on scheduled time, but records are not updated 

okay, if it is coming up then I think the issue is with the access of the 'run by' user here. When you are manually running it then it is executing with your account.

 

Instead of system admin put your account in the 'run by' and check if the record is updating or not at the scheduled time.

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Mio Matsushita
Mega Sage

Hi

 

If the execute now button works as expected, the cause may be the execution user.
The user who runs the script for a scheduled job may be different depending on whether it is run automatically or by Execute Now.

 

First, check the transaction log to see if the scheduled job is executed.
Search the transaction log for records that contain the name of the scheduled job in the URL field.

 

Next, set the scheduled job script to record logs with gs.info(), and check how far the script has run and whether any errors have occurred.

@Mio Matsushita I have used gs.info and checked the logs, its showing the info msg as well  when it is running on scheduled time, but records are not updated in issue table