Questions tagged [schedulebatch]

Class than can be scheduled to run at a certain time and invoke a batchable class

Filter by
Sorted by
Tagged with
31
votes
3answers
4k views

System.scheduleBatch issue

I have tested the new Summer '13 System.scheduleBatch method in a DE org and am wondering if I have misunderstood its usage. My principle reason was because I wanted to know if it would allow me to ...
21
votes
4answers
5k views

Scheduled job governor limit workaround

I am looking for a solution where I can schedule more than 5 jobs (Running/Queued) at a time. but there is a governor limit that, we can have only up to 5 jobs that can be in Running/Queued status at ...
15
votes
2answers
31k views

Scheduling batch Apex

Hi this is my batch apex code global class batchAUpdate_based_on_stage implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext BC) { ...
15
votes
1answer
11k views

Using Batch Apex on millions of records

Part of our app behaviour is going over millions on records and updating their data. From what I read, we can do it using Batch Apex although I am not certain I fully understand how it works. Here ...
15
votes
3answers
25k views

How can I query the class which the schedule job will call

I am trying to get the name of the schedule / batch classes called by the schedule job Trying this select Id,CronJobDetailId,CronJobDetail.Name, NextFireTime,PreviousFireTime,State,StartTime,...
14
votes
5answers
18k views

How to test a scheduler which runs a batch?

I have a scheduler class which calls a batch Apex. I want to write an Apex test for the scheduler class. However, the test fails. It seems that the testing framework does not execute the batch class. ...
13
votes
1answer
8k views

Scheduled Apex, Callouts and Running a Batch

I don't think what I am trying to do can be done with my current setup, but before I embark on some rework, I just wanted to check I haven't missed an approach... I have a scheduled class that ...
13
votes
3answers
3k views

Batch @future calls?

Im trying to build what seemed like a simple SMS messaging application using Twilio's api and running into a few strange momments. So I have an SMS object that stores the messages and i wrote a ...
12
votes
3answers
9k views

Too many callouts: 1 in Salesforce Batch

When i am sending one HTTPRequest it's giving error : System.LimitException: Too many callouts: 1 Don't understand why...pls help me out. Thanks! Here is my code: global class ClassName ...
12
votes
2answers
2k views

Does Test.stopTest() ensure a System.Schedule/Database.Batchable completes in a test?

I am struggling to successfully test some code that is essentially the same as the code here Apex test class for schedulable class that checks for 5 batches running already. I can get the System....
12
votes
1answer
11k views

Find Apex batch status programmatically

I have a batch class, I need to email and run another batch in the 'Finish' method of batch ONLY IF the batch ran successfully. I would like to have batch status in the finish method (like the batch ...
11
votes
4answers
207 views

Ghost processes / batch processes (NA34 and NA39)

3-30-2017 Just got a call from sf tier one wanting me to show them how to replicate the issue SMH. They then point me to the dev forums and closed the case ugh We are seeing multiple customers having ...
11
votes
1answer
5k views

Can a class implementing Database.Batchable also implement Schedulable and schedule itself to run?

Rather than creating a separate Schedulable class which executes my Batchable class (which in turn has a callout), shouldn't I be able to have my Batchable class also implement the Schedulable ...
10
votes
2answers
11k views

Apex cron job command to schedule an apex job to run every 4 hours daily

I have a requirement where i need to run an apex batch job every 4 hours daily monday to friday and all months in a year. I looked at the apex cron job documentation to be setup using code snippets in ...
9
votes
1answer
17k views

System.LimitException: Too many queueable jobs added to the queue

I have a scheduler class which is scheduled to run every 5 min which calls a batch class. This batch class calls a method from another class which adds multiple jobs to a queue. When it's scheduled I ...
8
votes
1answer
4k views

How to schedule Batch Apex to run once in a year

I'm a very much new to apex coding and I'm stuck with this problem kindly help to come out of this problem. Scenario : I have a one custom object called child__c and i have a custom field by name ...
8
votes
2answers
989 views

Disadvantage To Using Batch?

This answer got me wondering, is there a disadvantage to using a Batchable for simple scheduled functionality, as opposed to executing the functionality purely via Schedulable? Its [sic] better to ...
7
votes
1answer
4k views

Apex Batch - Is execute method called if start returns 0 results?

I want to know if the execute method in a batch is still called if the query in start() returns 0 records. I put debugs in the beginning of the execute method, I know start will not return any ...
7
votes
1answer
106 views

Scheduled Apex with one-time execution not being executed

We have a number of Scheduled Jobs that are scheduled with repeat and these are all working fine. We have a handful of Scheduled Jobs that are dynamically scheduled and re-scheduled, either as one-...
6
votes
2answers
36k views

CRON to schedule batch class to run everyday at 10PM

how to set CRON for a batch class which needs to be scheduled at 10PM daily
6
votes
3answers
12k views

Scheduling a Batch job at a particular time

I have a Apex batch class which I would like to schedule at a particular date time. The date time is stored in a variable and changes dynamically. ex Datatime scduleDateTime = datetime.now() ; I want ...
6
votes
2answers
1k views

Batch apex scheduling

I am calling multiple Batch Apex classes (more than 5) from another apex class and I want to build apex logic so that it doesn't kick off next batch apex if there are already 5 running/queued Apex ...
6
votes
2answers
187 views

Current state of reliable execution scheduling

A number of approaches to more reliable scheduling and continuous processing have been used over time on the Salesforce platform, all of them suffering from serious drawbacks. These include: suicidal ...
5
votes
1answer
217 views

Alert if a batch process hasn't run recently

I have a batch that runs every minute. In our recent salesforce maintenance window, it stopped running, and has to be restarted manually. This happens occasionally. Is there a way to monitor is a ...
5
votes
6answers
14k views

System.UnexpectedException: No more than one executeBatch can be called from within a testmethod

This is the test method i have writtenfor batch apex ProductUpdate .Even if i have a single callout to Database.Executebatch() I am getting the following error. Please help ! @isTest (seeAllData=...
5
votes
1answer
822 views

Batch Apex class failure - CPU time limit exceeded

I am facing a sudden bug that arose from a custom scheduled batch class in the system. This scheduled job has been running smoothly for over a year now, but it seems as though a recent influx of ...
4
votes
4answers
7k views

How to overcome the 2000 row limit for analytic snapshot entry?

So there is a 2000 limit of rows per analytic snapshot, and there is an idea to remove that limit. Until than: How can I have more than 2000 rows from the Analytic Snapshot entered into Salesforce?
4
votes
1answer
2k views

Testing a batch job which is scheduled through Handler class

In my handler class I schedule a batch class to run and update a field of records after Insert. I have the below code to schedule the batch to run after insert happens: public class sample{ public ...
4
votes
1answer
2k views

How to re schedule a batch if already 5 apex batch jobs are running

I am trying to schedule a batch after 15 mins from my post installation script which take 100 records and process it. But it might be possible that when my scheduled job will start already another 5 ...
4
votes
1answer
2k views

Scheduling Batch class

How to schedule the batch for every two hours per day? I try like this String schedule = '0 0 1/2 * * ?'; System.schedule('Jobname',schedule,new SampleTracking()); but i don't know it is ...
4
votes
1answer
1k views

Schedule deployment change set

I have the need to make a changeset once a week from develpment enviroment to test enviroment. Is it possible to schedule this action? I would like to create a batch job to do this but I can't find ...
4
votes
1answer
3k views

Does Test.stopTest() cause ALL waiting asynchronous functions to fire?

For practice, I'm composing on a unit test for a Schedulable class: /** * Example of scheduling Apex Batch Processing * @see Apex Workbook, page 68 **/ global class WARE_CleanMerchandiseScheduler ...
4
votes
1answer
1k views

Explicitly change the context of User while scheduling a batch

I have a requirement where I schedule a batch to run via trigger on insert and update event. However, the batch schedules in the context of the User who makes the changes. Because of which the ...
4
votes
1answer
2k views

Schedule Job does not execute

Since last Wednesday one of my schedules jobs (future calendar) does not execute but it schedules next time.I tried to remove and create again the job but was the same. If I execute the Batch manually ...
4
votes
1answer
345 views

Scheduled Job started, but no log entry found

I have exactly the same configuration across 3 orgs - DEV, UAT and PROD. I've got a few scheduled jobs that apparently started on the 06/11/2014 and one that started on the 01/11/2014 (Viewing ...
3
votes
2answers
2k views

Handling the exception in my scheduler Class

I have written a scheduler class which can schedule a batch job to run every 15 min. I wish to handle a scenario - if there is any exception during scheduling I do not want the chaining of scheduled ...
3
votes
1answer
1k views

Scheduling a batch process using UI- Which timezone does it schedule on?

When we schedule a batch process to run using UI, which timezone does it run? Does it run on the user's timezone or the org's timezone or any other. I need a particular schedulable batch to run on 1 ...
3
votes
1answer
11k views

how to write test class for batch class?

can any one give the sample test class for this code i am not awareness in testing please help me. global class SearchAndUpdate implements Database.Batchable<sObject>,Schedulable{ global ...
3
votes
2answers
3k views

How to run a scheduled job every 1 minute , and automatically start the re-scheduled automatically? [duplicate]

How to run a scheduled job every 1 minute , and automatically start the re-scheduled automatically again and again same process. I am trying this example below way. But it can't reschedule ...
3
votes
2answers
1k views

QueryLocator generates scope of the Object

I am recently working with building apex batch job and I came across Database.QueryLocator which I believe can create scope of the object which is passed to the execute() method. I do not understand ...
3
votes
1answer
5k views

Batch apex execute method not invoked

I got a batch apex as below global class Recalculatemembers implements database.batchable<sobject> { public final string query; //Get the query in constructor global ...
3
votes
3answers
3k views

execute batch class automatically

I have create batch class, i am calling in Developer Console but i want execute directly like when i schedule every monday. how to shedule this batch class global class contact_batch_update_Department ...
3
votes
1answer
639 views

How can I delete/abort all scheduled jobs for a particular apex class?

I need to delete/abort all schedule jobs associated with a particular apex class. There are nearly 1500 scheduled jobs in my org. Any tips on how to approach this?
3
votes
1answer
1k views

batch apex finish method to schedule another batch job with scope of 100 due to callout limit

The schedule_batch_mdm_role_definition I believe is working fine. global class schedule_batch_mdm_role_definition implements schedulable { global void execute(SchedulableContext sc) ...
3
votes
1answer
683 views

Split Batches if Batch is above a certain size. System.schedulebatch

A bit of background, I am looking to make a work around for the governor limits for daily email usage. As it stands I am able to schedule my batch of emails to send but I am having trouble splitting ...
3
votes
2answers
283 views

Batch Class Error as System.StringException: Invalid id at mail.setTargetObjectId(c.Owner.Email)

I have a written a Batch Class to send an notification email 60 days before the contract end date.I have created the email template and used in the code.But the system throws an error as : Batch ...
3
votes
1answer
169 views

Issues with Batch Queuing?

Has anyone else run into issues where their concurrent batches don't really run concurrently? Supposedly there is a limit of 5 and beyond that goes to the Flex Queue, but I consistently only have a ...
3
votes
1answer
4k views

Schedule job to run twice a day beginning at 10 AM

I am new to scheduled batch apex jobs. I am trying to run a job every day at 10 AM and 10 PM but the logic doesn't seem to be working. Here's what I have so far Time currentTime = Datetime.now().time(...
3
votes
1answer
1k views

how to schedule job with start and end?

I want to schedule a apex classes through apex code and need to have a cron expression with a fix startdate & enddate. It needs to be also possible to set the startdate & enddate like below: -...
3
votes
4answers
3k views

Exporting salesforce record dynamically using data loader

I am using Data loader using command line interface(CLI) to export salesforce data in my local system. Also using Windows scheduler to schedule this task on daily basis. <!DOCTYPE beans PUBLIC "-...

1
2 3 4 5
9