How to check if the schedule job is completed

deepasubram
Tera Contributor

Hi,

How to check if the schedued job is completed execution or not. In one of my scheduled job it got completed but error message comes up in the Job log table. Also state changes to ready. 

 

How to check if scheduled job completed or not without any errors? how to find the execution history for the same?

Thanks,

Deepa

3 REPLIES 3

Bhavya11
Kilo Patron
Kilo Patron

Hi @deepasubram ,

 

please refer this thread.

 

Thanks,

BK

Matthew_13
Kilo Sage

Check System Scheduler → Scheduled Jobs → Executions (sys_trigger) to see whether the last run finished and whether it shows an error.
Then check Job Logs (sys_job_log) for the run—this is where success or failure is recorded.

Ankur Bawiskar
Tera Patron
Tera Patron

@deepasubram 

in your scheduled job script always use try catch block to handle exception and add log before the code starts and before the code ends

this will help you tracking that job

runScript();

function runScript() {
    try {
        gs.info('Job started' + new GlideDateTime());
        // your code here

        gs.info('Job finished' + new GlideDateTime());
    } catch (ex) {
        gs.info("Exception in job" + ex);
    }
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader