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
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. ...
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 ...
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,...
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 ...
2
votes
2answers
302 views

Avoid Lock Row exception in Batch Processing

I have a Batch on Lead that is scheduled to run every 5 minutes. The criteria to pick the record in Batch is a field on lead ex. Flag = True. let's say very first-time batch runs and there are 50k ...
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....
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 ...
2
votes
1answer
3k views

Processing callouts from Batch

I have a tough scenario where a future method should be called from a batch.I came across various articles stating that it is not possible. My scenario is i need to send emails for contacts of account ...
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=...
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 ...
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
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 ...
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 ...
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 ...
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-...
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?
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 ...
2
votes
1answer
1k views

Help with “System.UnexpectedException: Note can't be saved” in batch apex

I am trying to create a batch apex job that will find all tasks within a date range (for testing I have it set to one date), create a note (ContentNote) and link it to the whatid or whoid from the ...
2
votes
2answers
2k views

execute apex batch only if not running

I have below trigger where I am executing a batch apex. I need to see whether the batch job is currently not running. Can someone help me here? Apex trigger: trigger BatchTrigger on ...
1
vote
2answers
2k views

Not able to see the class scheduled by a schedulable apex

I was looking through the scheduled jobs in my org. I would like to know which apex class is scheduled through these jobs. Please let me know how i can find this information?
0
votes
2answers
4k views

Please help! First error: Too many query rows: 50001 in my Batch Job

In my Batch Apex Job, i keep getting the error 'First error: Too many query rows: 50001' and i cant reduce the result return from my statement, i need to process all data, can anyone suggest me a way?...
0
votes
1answer
39 views

Batch class giving not working as expected

I have a requirement where i need to update amount pipeline field in accounnt object for the newly created account the value need to be come from sum of opportunities associated with that particular ...
0
votes
1answer
243 views

Schedule Iteration of Webservice Callouts

I have an endpoint I am getting updates from, but the only arguments the end point takes is two date parameters. To keep the heap size down, I am limited to about a date range of three months. I am ...
0
votes
1answer
2k views

Execute method in Apex batch never called

I have an apex class though which I do batch processing of some xml files. Below is a part of the code from my apex class: global class DoHMHParsing implements Database.Batchable<sObject>, ...
0
votes
1answer
176 views

Batch Apex creating Multiple contentdocumentlinks when trying to “convert” tasks to notes…

I am trying to look at all tasks for a specific time frame, then create a note and set the LinkedEntityId to the whatid or whoid. This code creates the content note, 1 for each task. But then created ...