You need to sign in to do that
Don't have an account?
John Neilan
Scheduled Apex
Hello,
I've created a trigger to count Tasks related to an Opportunity. The trigger fires when a Task is inserted, updated, or deleted and works as expected. I would like to schedule a nightly update that on Tasks with a certain Subject that will refresh the counts on the Opportunity I created the class below from SFDC documentation, but I'm unclear on how to include the scheduled run time and how to implement it. Can anyone help!
I've created a trigger to count Tasks related to an Opportunity. The trigger fires when a Task is inserted, updated, or deleted and works as expected. I would like to schedule a nightly update that on Tasks with a certain Subject that will refresh the counts on the Opportunity I created the class below from SFDC documentation, but I'm unclear on how to include the scheduled run time and how to implement it. Can anyone help!
global class RenewalTasksDaily implements Schedulable { global void execute(SchedulableContext ctx) { CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :ctx.getTriggerId()]; System.debug(ct.CronExpression); System.debug(ct.TimesTriggered); ClassRenewalTaskCount TC = new ClassRenewalTaskCount(); TC.taskCount(Trigger.new); } }
To schedule a schedulable class, you can go in the Setup > Develop > Apex Class
Then you'll have the "Schedule Apex" Button.
You'll then be able to choose the class and frequency.
Regards,
Jerome
All Answers
To schedule a schedulable class, you can go in the Setup > Develop > Apex Class
Then you'll have the "Schedule Apex" Button.
You'll then be able to choose the class and frequency.
Regards,
Jerome
if the schedule apex interface is not enought for your needs, you can always schedule it in the developer console.
you can then schedule it more frequently
Regards,
Jerome