Questions tagged [cron]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
2k views

Cron expression to run Job every second Friday

I need to schedule my class to run every two weeks on Friday. I see this in questions. However It is not excactly what I want. And I can not came up with an idea hot to write a cron expression for ...
Vitalii Dehnerys's user avatar
0 votes
1 answer
72 views

Schedule Apex not working properly

I have a batch that schedule a job for the next hour but in my Production environment is scheduling it for the following month. public void finish(Database.BatchableContext bc) { Datetime now = ...
molinet's user avatar
  • 835
0 votes
1 answer
431 views

Evaluate cron expression

I am developing something custom where I need to save a schedule on some records. This will not be used for salesforce scheduling. But we just require to store a schedule in the most efficient manner. ...
DebaSen's user avatar
  • 59
0 votes
1 answer
214 views

How to not abort jobs that are already aborted?

I have a function that gets called as part of reschedule logic in a Shedulable Apex class that implements System.Schedulable. The following code only gets called when a reschedule is needed. Rather ...
kratos's user avatar
  • 521
1 vote
1 answer
193 views

What CronTrigger State will prevent a call to System.abortJob to fail?

Looking at https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_crontrigger.htm and I see that it has state values such as: The current state of ...
kratos's user avatar
  • 521
0 votes
1 answer
147 views

Job does not exist or is already aborted when I am trying to kill a job id

private void reschedule(CronTrigger cronTrigger, ISchedulable schedulable, MySchedulableContext context) { System.abortJob(cronTrigger.Id); String newTrigger = schedulable....
kratos's user avatar
  • 521
0 votes
1 answer
111 views

4 Schedule Statements using scheduler vs scheduling a batch from finish method for every 15 mins

I want to schedule a job every 15 mins, for now I have created a scheduler class and using 4 statements to schedule it, but then again there is no guarantee that a job might complete itself in 15 mins ...
Isha's user avatar
  • 163
0 votes
1 answer
391 views

schedule job using cron expression

How we can execute/schedule job every month's first week of saturday using cron expression. 0 0 13 * * ?
cloudZigZag's user avatar
  • 1,356
1 vote
1 answer
82 views

Can I Start/Stop a job based on a parameter?

I have a Cron job that runs every minute: Datetime sysTime = System.now().addMinutes(1); String cronExpression = '' + sysTime.second() + ' ' + sysTime.minute() + ' ' + sysTime.hour() + ' ' + sysTime....
Saariko's user avatar
  • 5,541
0 votes
1 answer
232 views

Is it possible schedule an apex job to run several times everyday but during an interval time? [closed]

I am quite confused about the CRON expressions. I would like to run a job several times every day but in a time interval. For example: Every day run X job every 2 minutes from 3:00 am to 4:00 am. If ...
gyau's user avatar
  • 13
0 votes
1 answer
428 views

CronTrigger.TimesTriggered is not incrementing after Test.stopTest() in Apex test class

I have a scenario in which an email is being sent to Users having admin profile at the end of the month for Closed Opportunities. Code seems to be working fine when tested in execute anonymous window ...
Ritesh Gupta's user avatar
1 vote
1 answer
2k views

Can one Schedule Apex Job run multiple times parallelly?

Scenario: I've created a Schedule Apex Job to run an 'X' class after every one hour. I will be running it through Developer Console using 'Anonymouse Execute Window'. The 'X' class inserts a large ...
Mehedi's user avatar
  • 379
0 votes
1 answer
91 views

Scheduled Apex not firing

Still fumbling my way through this problem: Help understand Apex class / bulkilfy I decided to go ahead and create a query in Apex that gets the Leads I need to be reassigned and push those into the ...
Sgrove 's user avatar
0 votes
0 answers
57 views

Apex Scheduler - CronTrigger gets created but doesn't run

We are running into an issue with the Apex Scheduler. We've scheduled some code to run every half hour. Since the ".schedule()" method only allow to run code hourly, we call the method twice ...
Lucas's user avatar
  • 1
2 votes
1 answer
4k views

Get the scheduled Job name using Apex class name

I have seen many posts about finding out name of the apex class associated with a scheduled job. However, i have an opposite need. I am updating a scheduled class, that was scheduled to run at a ...
user2957592's user avatar
0 votes
2 answers
2k views

CRON Expression for specific time [closed]

How to schedule batch class to run at specific time 12.30 AM CST Daily. How to make it run at CST Timezone.
user70573's user avatar
0 votes
1 answer
2k views

Dynamically Scheduling Apex to Run at Various Points in Time

I see a lot of documentation on scheduling Apex to run repeatedly (i.e. every day at 1am), or even run once at a specific point in time, but I don't see anything about dynamically scheduling Apex to ...
number41's user avatar
  • 918
0 votes
1 answer
1k views

How to schedule an apex batch class on every 15th and last day of the month?

I have used cron expression -> '0 1 12 15,L * ?' for scheduling the batch class at 12:01 am on every 15th and last day of the month. But it is erroring out.
HG_'s user avatar
  • 125
-1 votes
1 answer
135 views

CRON Expressions every hour at specific times

Is it possible to run CRON job every hour at a specific time at that hour? I only ask because I want to spread out my scheduled batch classes throughout the hour to avoid maxing out the flex queue.
Matthew Metros's user avatar
2 votes
1 answer
2k views

"Every 30 min" cron expression runs only hourly [duplicate]

I have a Lightning Component where users can choose how often an Apex Batch should be run. As options, I want to allow 30min, hourly and daily. Changing that should modify the CRON expression of a ...
Pranav Chitrans's user avatar
0 votes
1 answer
313 views

Schedule class from the CronTrigger?

I have a requirement where I need give user an option to schedule a batch in a custom lightning configuration page. I can able to do it when we create a single schedule for a particular Batch by using ...
Hariprasath's user avatar
2 votes
1 answer
2k views

Get the actual Previous Fire Time of a CronTrigger / Scheduled Apex

I am exeuting Scheduled Apex that should do processing based on the last execution time of the particular code. I query some records for processing and I only want to query those records, that have ...
J. Schreiber's user avatar
  • 1,500
1 vote
2 answers
1k views

Delete cron jobs instead of using abort

Currently I'm using the System.abortJob(job.Id); method to abort the execution of already scheduled cron jobs as per the following code: List<CronTrigger> cronjobList = [SELECT Id, ...
lemdev's user avatar
  • 407
4 votes
1 answer
2k views

Which scheduled jobs count towards the max concurrent scheduled jobs limit?

Per the docs we can only have 100 scheduled apex jobs at any one time in most orgs (5 in dev orgs). Which jobs count towards those limits? Would the following query return the right number? SELECT ...
Ralph Callaway's user avatar
0 votes
1 answer
290 views

How to abort Cronjob by name?

I have cronjobs which are scheduled in after update trigger. When some user make an update in one and the same record I need the previous cronjob(batch) to be aborted and to start a new cronjob. How ...
lemdev's user avatar
  • 407
2 votes
1 answer
1k views

Find what apex a cronjob Triggers

Scenario: Documentation on my org has a gap regarding a scheduled batch apex. This batch code updates a related list on the lead object. This List and process is call ‘nearby references’ and ‘find ...
Ryan Sherry's user avatar
2 votes
1 answer
568 views

Can not see "Manage" button in Scheduled Jobs

I have System Administrator Profile. The “View Setup and Configuration” checkbox is checked. When my CRON expression is like (monthly): '0 0 3 * * ?'; I can see the "Manage" button, but when my CRON ...
Dmitriy Yurkin's user avatar
0 votes
1 answer
630 views

Apex CronTrigger Throws error while aborting: Job does not exist or is already aborted.

I keep getting this error when I try to abort a scheduled job in my batch job code. Below is my code: Datetime dt = system.now().addMinutes(Integer.valueof(myCustomObject.Time_Interval__c)); ...
Ramy's user avatar
  • 61
0 votes
1 answer
413 views

Schedule batch job using cron expression

I have a requirement where I need to schedule a batch job 4 times in a day, at 1 AM EST, 10 AM EST, 3 PM EST, and 8 PM EST. I have scheduled this using a cron expression in Developer Console. I ...
Anil Kumar's user avatar
0 votes
1 answer
109 views

CRON Check for all iterations

I have a scheduler with the CRON expression as 0 30 13 5-5 9-10 ? 2018-2018 From the above my thinking is it will run from sep 5th to oct 5th of 2018. But it's breaking in month end. Is there a ...
Harry's user avatar
  • 3
4 votes
2 answers
4k views

What's the difference between AsyncApexJob and CronTrigger?

Roughly I know that when I schedule a Schedulable, I'm creating both a CronTrigger and an AsyncApexJob, but I'm confused as to how the two objects relate to each other and what the significance of ...
user823447's user avatar
1 vote
2 answers
1k views

Schedule batch execution using API

I am currently implementing scheduled migration of data from external system to Sales Cloud. I would like to migrate data using bulk API and then, after the process is finished, schedule a batch ...
Andrej Lucansky's user avatar
0 votes
1 answer
776 views

Test Class for Scheduled Apex

I have a piece of scheduled apex that runs once a month, but behaves differently depending on the month. In attempting to write unit tests the unit test triggers the scheduled apex, but does not do so ...
user40550's user avatar
0 votes
1 answer
1k views

Schedule apex every second week

Is there a way to schedule an apex class(schedulable of course) to run every second week? I thought I could do it in the UI by scheduling 2 jobs for 2nd and 4rd Friday of the month, but the moment I ...
Novarg's user avatar
  • 5,226
1 vote
1 answer
2k views

cron expression for running every 2months

Can someone help me with setting the cron expression to run every 2 months starting from a particular day Here is the one which I tried : public static String sch = '0 18 * */2 *';
user46620's user avatar
7 votes
3 answers
14k views

Schedule apex one time

I am planning to schedule apex from my class if it meets certain conditions. Is it possible to schedule apex for a single time? If yes is it done using Cron expression or any other method.
Ishan's user avatar
  • 537
0 votes
1 answer
114 views

Error in comparing cron expression

I am getting this weird error while comparing Cron expressions but I am not sure what it is indicating. System.AssertException: Assertion Failed: Expected: 0 0 12 1/1 12 ? 2022, Actual: 0 0 12 1/...
Ishan's user avatar
  • 537
0 votes
2 answers
483 views

Bug? Same Batch Can Be Run From Cron & Schedule Apex

I have come across a strange case where the same batch job was running with two different users and went in to dig upon and found that one was scheduled via Schedule Apex screen and another one using ...
DJD's user avatar
  • 314
3 votes
2 answers
405 views

APEX trigger with CRON job to check on a custom field

Using the Apex Schedule documentation on Salesforce I have created the following APEX code: global class CheckingDate implements Schedulable { global void execute(SchedulableContext ctx) { ...
TheAdmin's user avatar
  • 335
2 votes
2 answers
235 views

Apex schedule crontab syntax

I want to schedule a batch to run everyday at 1 am. I've tried the following code as suggested here: System.schedule('BatchAccount daily at 5 am', '0 0 1 * * ?', new BatchAccount()); But if I view ...
tony danza's user avatar
3 votes
1 answer
292 views

Need assistance on scheduled jobs

I have a scheduled job in my org which was scheduled 2 years ago without an end date. It runs every Friday at a specific time, which means it was scheduled using a cron expression. If I delete that ...
Learner_sfdc's user avatar
4 votes
0 answers
114 views

Is This Project Possible?

I'm setting up a Wordpress site for a new customer. They have moved their customer database from a plesk environment to a salesforce database, 13 records per row including address, id, phone number, ...
Many Hats Digital's user avatar
17 votes
4 answers
21k views

Cannot delete AsyncApexJob using System.abortJob

I'm facing the "ghost" job issue in an organization (thankfully is a sandbox). I had a class scheduled to run in a daily basis, and it was working fine, until I accidentally scheduled it again (2 jobs ...
Renato Oliveira's user avatar
4 votes
1 answer
830 views

PDF Generation Salesforce

I'm kinda stuck in the middle of all the limitations Salesforce has for creating a pdf out of a Visualforce page. What I have is a Visualforce page that takes some parameters and I use to rerender as ...
raym0nd's user avatar
  • 886
5 votes
1 answer
1k views

question on crontrigger and possible state values

Whenever a scheduled Apex Job is submitted, an entry is made in the CronTrigger table. What I see is, when this job is completed successfully, I see the State changed to "DELETED". Based on the SOAP ...
apn's user avatar
  • 1,722
1 vote
1 answer
1k views

CronTrigger : set StartTime and EndTime

Is it possible to set the StartTime and EndTime fields of a CronTrigger object ? I'm not able to set this fields in Apex code, I have the error below : Field StartTime is not writeable I know I ...
SF_user's user avatar
  • 3,586
3 votes
1 answer
2k views

Scheduled job : get next execution date

Is there a way to get the next execution date of a scheduled job ? I have my Apex code : Scheduler scheduler = new Scheduler(); // Scheduler class implements Schedulable String expr = '0 0 13 * * ?';...
SF_user's user avatar
  • 3,586
5 votes
2 answers
8k views

How to schedule a job twice a day

I have a job and I have to schedule this Job twice a day. Currently it is running at 12 PM ET and 1 PM ET. So my Cron String looks like this. public static String CRON_STR = '0 0 12,13 ? * MON-FRI *'...
Noob_NoVoice's user avatar
  • 2,709
2 votes
1 answer
317 views

Multiple timings in a single cron

I want to schedule a job which wil run nightly at 7 PM ET and 8 PM ET. http://www.cronmaker.com/ provides a wizard to construct the scheduling string. Is it possible to schedule both runs in one ...
Noob_NoVoice's user avatar
  • 2,709
1 vote
1 answer
804 views

Why Deleting Scheduled Jobs with Apex Suddenly Stopped Working March 2015

Any thoughts on why the removeExistingCompletedJobs Method suddenly stopped working around March 2015? We now get an Apex error "Job does not exist or is already aborted" I'm not sure if it coincided ...
ddeve's user avatar
  • 1,537