Last active
December 19, 2015 00:19
-
-
Save kevinohara80/5867465 to your computer and use it in GitHub Desktop.
Repro code for Apex Summer '13 String/Id issue with System.abortJob(String);
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class ScheduledJob implements Schedulable { | |
global void execute(SchedulableContext sc) { | |
System.debug('Executing'); | |
} | |
global static void schedule() { | |
ScheduledJob job = new ScheduledJob(); | |
System.schedule('Test Job', '0 0 13 * * ?', job); | |
} | |
global static void unschedule() { | |
CronTrigger cron = [SELECT Id FROM CronTrigger LIMIT 1]; | |
System.abortJob(cron.Id); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestResource(urlMapping='/unschedule') | |
global with sharing class ScheduledJobRest { | |
@HttpGet | |
global static void doGet() { | |
ScheduledJob.unschedule(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is yet another String/Id related issue in Summer '13. This one has to do with using the System.abortJob() within an Apex REST request. The above code will reproduce the issue. Here are the steps.
ScheduledJob.schedule()
.You will receive the following error on Summer '13:
System.StringException: entityId : U#233.3fffffff (CronJobDetail)
Notes: