Questions tagged [cron]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
247 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 ...
0
votes
1answer
34 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 ...
2
votes
1answer
62 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 ...
1
vote
2answers
141 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, ...
3
votes
1answer
71 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 ...
0
votes
1answer
23 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 ...
1
vote
1answer
55 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 ...
2
votes
1answer
91 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 ...
0
votes
1answer
48 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)); ...
0
votes
1answer
83 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 ...
0
votes
1answer
31 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 ...
2
votes
2answers
2k 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 ...
0
votes
2answers
127 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 ...
0
votes
1answer
144 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 ...
0
votes
1answer
120 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 ...
1
vote
1answer
400 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 *';
2
votes
3answers
3k 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.
0
votes
1answer
50 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/...
1
vote
1answer
278 views

Validating a cron expression

I have a requirement where I accept a cron expression from the user and schedule a job with System.schedule. Before doing that, I need to check if there is an existing scheduled execution for that job ...
0
votes
2answers
225 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 ...
3
votes
2answers
191 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) { ...
2
votes
2answers
136 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 ...
3
votes
1answer
281 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 ...
4
votes
0answers
101 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, ...
13
votes
4answers
7k 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 ...
4
votes
1answer
599 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 ...
5
votes
1answer
253 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 ...
1
vote
1answer
710 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 ...
3
votes
1answer
776 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 * * ?';...
5
votes
2answers
4k 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 *'...
2
votes
1answer
273 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 ...
1
vote
1answer
681 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 ...
1
vote
2answers
1k views

CRON Expression to run half past the hour

I understand how to make a job run on the hour and every hour. Is there a way to schedule the job to run every hour, but half past the hour e.g. 2:30, 3:30, 4:30 etc
1
vote
2answers
5k views

Scheduled Apex - CronExpression Question

I am currently having difficulty in understanding the CronExpression parameter for System.schedule() method. As per doc it says the syntax is "Minutes, Hours, Day of month, Month, Day of week, ...
1
vote
1answer
428 views

The best way to run scheduled jobs frequently (every 30 seconds)

I want to run an apex code every 30 seconds and want to use Scheduled Jobs. However, there are limitations on it. So far I have read the following options: 1- Run it on another server (e.g., unix) 2- ...
4
votes
1answer
738 views

Salesforce Cron Expression for every second and fourth Friday?

I want to run a class at 10 AM every 2nd and 4th Friday of each month. Came up with the expression below, but it's not scheduling correctly - only schedules the fourth Friday. Could it be that ...
2
votes
2answers
3k views

Getting Scheduled Apex Job name in the apex class

I have two scheduled apex jobs ScheduleJob1 and ScheduleJob2. Both these jobs call an apex class implementing the Schedulable interface global class TaskController implements Schedulable { ...