function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sampath BukkaSampath Bukka 

How do I get a ID for a scheduled job?


Hi, 
    Can someone please help me. I've mentioned the job list below. In this I would like to get the Id of Scheduled Job name.

for example I have a scheduled job name "Accounts without Activities" in the list below, and I need  the Id of this scheduled job name.


User-added image
Thanks inadvance,
sam
Best Answer chosen by Sampath Bukka
Tushar sharmaTushar sharma
CronTrigger job = 
    [SELECT Id, CronJobDetail.Id, CronJobDetail.Name, CronJobDetail.JobType 
    FROM CronTrigger ORDER BY CreatedDate DESC LIMIT 1];
by query CronTrigger you get all your required Information