+ Start a Discussion
SFDC BeginerSFDC Beginer 

schedule apex status and number of times it triggred

 I wrote below  code in Debuglog window:
ScheduledApex_2 sa=new ScheduledApex_2();
String s='0 22 6 ? * *';
String myjob=System.schedule('Fifth', s, sa);
CronTrigger ct=[SELECT Status,TimesTriggered,NextFireTime From CronTrigger Where Id=:myjob];
when I want to know the  when it triggered and status for the first time it shceduled then only we are able to check by using above.
When I want to know the status once it is started and completed and number of times triggered, am unable do that.
for example: I shceduled and it ran for 2 times,
so when I am using above logic it is saying it is already shceduled.I am not getting any result.
I just want to know like status of myjob,  2 times triggered, and next schedule date is so and so etc 
could anyone please help me in this?
 
SKSANJAYSKSANJAY
Hi,

You can follow below link for detailed knowledge of CRONTrigger methods.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_crontrigger.htm

Hope this will help you.
Thanks,
Sanjay