You need to sign in to do that
Don't have an account?
Axaykumar Varu
CronTrigger
Hi..All
can we retrive Job ID from CronTrigger?,
if yes then please tell me how we can retrieve it...
Thanks,
Akshay
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Hi..All
can we retrive Job ID from CronTrigger?,
if yes then please tell me how we can retrieve it...
Thanks,
Akshay
Dude,
You can use both the formats.
To Convert From 15 char Id to 18 Char ID You just need to take it in to ID field. See the Example below.
String str = '0019000000G0IS8';
Id i = str;
system.debug('Str : ' + str+'\n ID : '+i);
Thanks.
All Answers
I am not sure what a CronTrigger is .
Is it a piece of code you have written ?
or Salesforce provides some functionality named CronTrigger ?
Help us to help you .
CronTrigger Represents a scheduled Apex job.
For more info see...
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_crontrigger.htm
Thanks,
Akshay Varu
Select c.TimesTriggered, c.TimeZoneSidKey, c.State, c.StartTime, c.PreviousFireTime, c.OwnerId, c.NextFireTime, c.LastModifiedById, c.Id, c.EndTime, c.CronExpression, c.CreatedDate, c.CreatedById From CronTrigger c
Hi sourav,
CronTrigger functionality is provided by salesforce. It Represents a scheduled Apex job.
If you want to know more about CronTrigger refer this links:
http://zachelrath.wordpress.com/tag/crontrigger/
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_crontrigger.htm
Thanks Rohit for replay
but does this give me Job ID? becoz I need to retrive JobId from CronTrigger and there is no such Field in cronTrigger.
so i want to know where actually JobId is stored...???
Thanks
Akshay Varu
The Id field represents the Scheduled Job ID.
Thanks Rohit,
bt ID field is of 18 digit where JobID field is of 15 digit, so is it same after converting 15 digit to 18 digit??
i am not sure about this
Thanks,
Akshay
Dude,
You can use both the formats.
To Convert From 15 char Id to 18 Char ID You just need to take it in to ID field. See the Example below.
String str = '0019000000G0IS8';
Id i = str;
system.debug('Str : ' + str+'\n ID : '+i);
Thanks.
Thanks Rohit,
I got the solution...
Akshay Varu
Please provide us solution that you found.
Basically salesforce has provide us batch classes functionality to work on the async process in salesforce to handle a huge amount of data like upto 50 millions record, and to make the process easy of batch class. we have some thing called schedulable interface which is nothing but if you want to schedule a batch class or any other class you can implement this inteface and call the batch class by making the statement saying that
Database.executebatch(pass the instance of respective batch class);
so there are two ways to schedule a batch class and they are:
1. through salesforce provide point and click process which available in saleforce schedule apex section.
2. through programatically where you need to specifically do it by using the system.schedulebatch method without having to implement the Schedulable interface.
so basically CronTrigger(it store the schedule information of scheduled job like nextfiretime,timesfired etc) and CronJobDetail(it contain the detail of schdeuled jon like job type nad name) are object and they use to get the count of Apex scheduled jobs. After the Apex job has been scheduled, you can obtain more information about it by running a SOQL query on CronTrigger and retrieving some fields, such as the number of times the job has run, and the date and time when the job is scheduled to run again,
PFB the example:
String jobID = system.schedule('job name', batchclassinstance, intervaltoexecutebatchinminutes);
CronTrigger ct = [SELECT TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :jobID];
OR
CronTrigger ct = [SELECT TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :sc.getTriggerId()]; wher sc is schedulablecontext variable.
OR
CronTrigger job = [SELECT Id, CronJobDetail.Id, CronJobDetail.Name, CronJobDetail.JobType FROM CronTrigger ORDER BY CreatedDate DESC LIMIT 1];
CronJobDetail ctd = [SELECT Id, Name, JobType FROM CronJobDetail WHERE Id = :job.CronJobDetail.Id];
Regards
AS