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

Jake Sadler
Kilo Sage

check the run as user is active and has the roles required and access

I have selected run as system administrator and  active  

@subbarayudu your script needs to be new GlideDateTime();

    var difference = GlideDateTime.subtract(idt1, idt2);
 
This is likely causing an error

@Jake Sadler GlideDateTime(); won't be supporting for scoped applications, that why i used var difference = GlideDateTime.subtract(idt1, idt2);, 

If we use  GlideDateTime() that working for back ground script but  in scheduled job not working even i click ececute now button also