I have a process that automatically builds a scheduled job a few minutes in the future every time it fires. This works great, but after there are ten such jobs, I get an Apex limit exception: You have exceeded the maximum number (10) of Apex scheduled jobs.
These jobs are all completed and I did check to make sure they have a status of 'COMPLETED' as well. When I delete them by going in through the UI, then the process works again.
1. Is this intended behavior?
2. Is there any way to programatically delete these old completed jobs?
Is there any way to change or delete a Scheduled Job ? I am able to create one easily enough, but once it is made I can only look at the values in the CronTrigger object, but not update them. Also, it seems I cannot delete them. I also looked at the System.AbortJob method, but that seems to only stop a job that is already running - I get an error if I try it on a Queued job.
The reason I am doing this is to try to create a 'sliding' job. So, when a trigger is fired the job will run in 5 minutes. But if the trigger is fired again before that 5 minutes is up, it will find the old job and either delete it and make a new one for 5 minutes out, or update the old one so the next scheduled time is in 5 minutes.
Any ideas are welcome!
This is driving me nuts!
A query that I create and test in Ajax Tools returns the information I desire... the same query launched from Apex DataLoader gives me a 'Malformed Query' error (with no meaningful details!) Here is the SOQL query, can anyone tell me what I'm doing wrong?
SELECT Account.Name, Name, Amount,
(SELECT Quantity, UnitPrice, TotalPrice FROM OpportunityLineItem)
Unless I'm blind (or insane) this query is formed exactly as shown on Page 106 of the Force.com Cookbook
So why does it fail when run from the DataLoader - And runs fine from AjaxTools?
BTW I get the same behavior whether I run it from the DataLoader GUI or from the CLI