You need to sign in to do that
Don't have an account?
wt35
System Log: how to run a class
Hello
Sorry if this has been posted already but I am looking for the syntax to run a class from an anonymous block in the system log.
This is the class:
global class checkSupportDailyTarget implements Schedulable{ global void execute(SchedulableContext sc) { //do some work }
I 've tried this:
checkSupportDailyTarget a = new checkSupportDailyTarget (); a.execute();
But I get the error
Compile Error: line 2, column 1: Method does not exist or incorrect signature: [checkSupportDailyTarget].execute()
Thank you
Marc
to run a schedule class
checkSupportDailyTarget a = new checkSupportDailyTarget ();
String sch = '20 30 8 10 2 ?';
system.schedule('Schedule1 Job', sch, m);
U may schedule it any time, for more on scheduling please check
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
Thank you but actually I am looking for a way to run it instantaneously from the System Log to see how my class works before scheduling it.
You can't really hit the execute directly, as it requires a SchedulableContext and I'm not aware of any way to generate one of these yourself.
The way around this I would say is to have your execute method simply call another method that does the work. Then you can call that directly once you've instantiated the class, as long as you don't need to get at any part of the SchedulableContext object.