Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 2995

Issues with writing, running, or testing scheduled Apex code, using the Schedulable interface.

0 votes

executing a scheduler

You actually do not need to even implement Schedulable to run a batch each hour. There is a method called system.scheduleBatch which will do the trick nicely here: public void finish(Database.Batchab …
Adrian Larson's user avatar
  • 151k
3 votes

Error: Method does not exist or incorrect signature: void schedule

You are trying to pass a Batchable implementation where Schedulable is expected. This is just one reason why it is better to roll both into the same class. Regardless, your schedule method should pass …
Adrian Larson's user avatar
  • 151k
1 vote

Schedule a Schedulable class

Once the schedule is already running, you execute the batch, not schedule it: public void execute(SchedulableContext context) { Database.executeBatch(new MyBatch()); } If you want a simple sche …
Adrian Larson's user avatar
  • 151k
2 votes
Accepted

Apex scheduler - execution may be delayed based on service availability

It's a multi-tenant system. Your server may be loaded up with requests at the time the job is scheduled to execute. You should read through these documents: The Force.com Multitenant Architecture As …
Adrian Larson's user avatar
  • 151k
2 votes

Apex scheduler - run two schedule jobs at the time

As you already know, time of execution is not guaranteed. That said, they will each start as close to the scheduled time as the system can manage.
Adrian Larson's user avatar
  • 151k
2 votes
Accepted

How to get the end date of a scheduled job which was scheduled via System.Schedule?

You want the EndTime field on the CronTrigger object. You could see the end date for all scheduled jobs with this query: SELECT EndTime, CronJobDetailId, CronJobDetail.Name FROM CronTrigger WHERE Cro …
Adrian Larson's user avatar
  • 151k
1 vote

Need help-apex cpu time limit exceeded

I recommend you use Data Loader for this task. Export the query you have already written Manipulate the CSV to set DisqualifiedReason__c and OwnerId to the proper values. Import the manipulated CSV …
Adrian Larson's user avatar
  • 151k
3 votes
Accepted

Schedulable error: You have uncommitted work pending. Please commit or rollback before calli...

Scheduling the job counts as pending work for the purpose if callouts. If you want to test the callout, manually run execute(null). To test the schedule itself, you'll likely find a @TestVisible flag …
Adrian Larson's user avatar
  • 151k
2 votes

Render Email with batch

I will pull my comments here into an answer. I suggest this general path: Create a Visualforce Email Template on Account. Have this template pull in relevant child Contact information. Create a c …
Adrian Larson's user avatar
  • 151k
1 vote

Attempting scheduled auto Lead creation

You have an extra opening curly bracket ({). That's forcing everything inside of it to be considered an initializer block and really confusing the poor compiler. global class MyClass { { …
Adrian Larson's user avatar
  • 151k
4 votes
Accepted

Schedule Apex to Update Leads based on Tasks

You should absolutely move this logic into a batch. If you need to update all 22k records, you will run into governor limits. Note that it is not advisable to include child records via subquery in a q …
Adrian Larson's user avatar
  • 151k
2 votes

How to Re-Create Scheduled Jobs After Deleting Them

If the event was scheduled via the UI, you should be able to get the information you want via SOQL. Here's the problem: CronTrigger has most of the data points you need, which you can access through C …
Adrian Larson's user avatar
  • 151k
0 votes

Error in comparing cron expression

When testing your scheduled jobs, asserting on the CRON string is going to far. You should just verify that the job got scheduled and leave it at that. MySchedulable job = new MySchedulable(); Test. …
Adrian Larson's user avatar
  • 151k
3 votes

Test class for Schedulable class

I would recommend moving your code into more dedicated classes. Sending emails has nothing to do with Schedulable. Usually imho a Schedulable class should just look like: public class MySchedulable i …
Adrian Larson's user avatar
  • 151k
1 vote
Accepted

System.SerializationException: Unable to load class:

Change your access modifier from global to public. Based on the comments, that fixes the issue.
Adrian Larson's user avatar
  • 151k

15 30 50 per page