Execute scheduled Apex class code on the Developer console

Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
1
down vote
favorite
I have the following scheduled Apex code, I want to try it out on the developer console, as salesforce scheduler offers to the run the code, once an hour only.
global class examExpiryAlert implements Schedulable
global void execute(SchedulableContext ctx)
List<Exam__c> objects = [
SELECT Name, Exam_state__c, Expiration_Date_WF__c, day7Alert__c
FROM Exam__c
WHERE Exam_state__c = 'Active'];
for(Exam__c e : objects)
if(e.Expiration_Date_WF__c >= Date.today()-7)
e.day7Alert__c = True;
update objects;
how can i run this code in the developer console to execute it right away, what parts do i have to remove or add?
apex query scheduled-apex developer-console
add a comment |Â
up vote
1
down vote
favorite
I have the following scheduled Apex code, I want to try it out on the developer console, as salesforce scheduler offers to the run the code, once an hour only.
global class examExpiryAlert implements Schedulable
global void execute(SchedulableContext ctx)
List<Exam__c> objects = [
SELECT Name, Exam_state__c, Expiration_Date_WF__c, day7Alert__c
FROM Exam__c
WHERE Exam_state__c = 'Active'];
for(Exam__c e : objects)
if(e.Expiration_Date_WF__c >= Date.today()-7)
e.day7Alert__c = True;
update objects;
how can i run this code in the developer console to execute it right away, what parts do i have to remove or add?
apex query scheduled-apex developer-console
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have the following scheduled Apex code, I want to try it out on the developer console, as salesforce scheduler offers to the run the code, once an hour only.
global class examExpiryAlert implements Schedulable
global void execute(SchedulableContext ctx)
List<Exam__c> objects = [
SELECT Name, Exam_state__c, Expiration_Date_WF__c, day7Alert__c
FROM Exam__c
WHERE Exam_state__c = 'Active'];
for(Exam__c e : objects)
if(e.Expiration_Date_WF__c >= Date.today()-7)
e.day7Alert__c = True;
update objects;
how can i run this code in the developer console to execute it right away, what parts do i have to remove or add?
apex query scheduled-apex developer-console
I have the following scheduled Apex code, I want to try it out on the developer console, as salesforce scheduler offers to the run the code, once an hour only.
global class examExpiryAlert implements Schedulable
global void execute(SchedulableContext ctx)
List<Exam__c> objects = [
SELECT Name, Exam_state__c, Expiration_Date_WF__c, day7Alert__c
FROM Exam__c
WHERE Exam_state__c = 'Active'];
for(Exam__c e : objects)
if(e.Expiration_Date_WF__c >= Date.today()-7)
e.day7Alert__c = True;
update objects;
how can i run this code in the developer console to execute it right away, what parts do i have to remove or add?
apex query scheduled-apex developer-console
apex query scheduled-apex developer-console
edited 1 hour ago
asked 1 hour ago
Niveth Kumar
215
215
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
4
down vote
accepted
Try:
new examExpiryAlert().execute(null);
context doesn't matter.
New contributor
Non Atomic Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
thanks a lot, this worked. Will mark as best answer
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
1
down vote
If you want to execute just a part of the class, you can extract the code and run that. However, Non atomic's way is best if you want all the functionality.
List<Exam__c> objects = [
SELECT Name, Exam_state__c, Expiration_Date_WF__c, day7Alert__c
FROM Exam__c
WHERE Exam_state__c = 'Active'];
for(Exam__c e : objects)
if(e.Expiration_Date_WF__c >= Date.today()-7)
e.day7Alert__c = True;
update objects;
thank you Caspar Harmer
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
1
down vote
You can create a cron expression to execute scheduleable class from Developer console.
String hour = String.valueOf(Datetime.now().hour());
String min = String.valueOf(Datetime.now().minute());
String ss = String.valueOf(Datetime.now().second());
//parse to cron expression
String nextFireTime = ss + ' ' + min + ' ' + hour + ' * * ?';
MyScheduledJob s = new MyScheduledJob();
System.schedule('Job Started At ' + String.valueOf(Datetime.now()), nextFireTime, s);
Schedule Apex
thank you for your support
â Niveth Kumar
1 hour ago
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
Try:
new examExpiryAlert().execute(null);
context doesn't matter.
New contributor
Non Atomic Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
thanks a lot, this worked. Will mark as best answer
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
4
down vote
accepted
Try:
new examExpiryAlert().execute(null);
context doesn't matter.
New contributor
Non Atomic Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
thanks a lot, this worked. Will mark as best answer
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
Try:
new examExpiryAlert().execute(null);
context doesn't matter.
New contributor
Non Atomic Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Try:
new examExpiryAlert().execute(null);
context doesn't matter.
New contributor
Non Atomic Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Non Atomic Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 1 hour ago
Non Atomic Games
561
561
New contributor
Non Atomic Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Non Atomic Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Non Atomic Games is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
thanks a lot, this worked. Will mark as best answer
â Niveth Kumar
1 hour ago
add a comment |Â
thanks a lot, this worked. Will mark as best answer
â Niveth Kumar
1 hour ago
thanks a lot, this worked. Will mark as best answer
â Niveth Kumar
1 hour ago
thanks a lot, this worked. Will mark as best answer
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
1
down vote
If you want to execute just a part of the class, you can extract the code and run that. However, Non atomic's way is best if you want all the functionality.
List<Exam__c> objects = [
SELECT Name, Exam_state__c, Expiration_Date_WF__c, day7Alert__c
FROM Exam__c
WHERE Exam_state__c = 'Active'];
for(Exam__c e : objects)
if(e.Expiration_Date_WF__c >= Date.today()-7)
e.day7Alert__c = True;
update objects;
thank you Caspar Harmer
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
1
down vote
If you want to execute just a part of the class, you can extract the code and run that. However, Non atomic's way is best if you want all the functionality.
List<Exam__c> objects = [
SELECT Name, Exam_state__c, Expiration_Date_WF__c, day7Alert__c
FROM Exam__c
WHERE Exam_state__c = 'Active'];
for(Exam__c e : objects)
if(e.Expiration_Date_WF__c >= Date.today()-7)
e.day7Alert__c = True;
update objects;
thank you Caspar Harmer
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
If you want to execute just a part of the class, you can extract the code and run that. However, Non atomic's way is best if you want all the functionality.
List<Exam__c> objects = [
SELECT Name, Exam_state__c, Expiration_Date_WF__c, day7Alert__c
FROM Exam__c
WHERE Exam_state__c = 'Active'];
for(Exam__c e : objects)
if(e.Expiration_Date_WF__c >= Date.today()-7)
e.day7Alert__c = True;
update objects;
If you want to execute just a part of the class, you can extract the code and run that. However, Non atomic's way is best if you want all the functionality.
List<Exam__c> objects = [
SELECT Name, Exam_state__c, Expiration_Date_WF__c, day7Alert__c
FROM Exam__c
WHERE Exam_state__c = 'Active'];
for(Exam__c e : objects)
if(e.Expiration_Date_WF__c >= Date.today()-7)
e.day7Alert__c = True;
update objects;
answered 1 hour ago
Caspar Harmer
12.2k21749
12.2k21749
thank you Caspar Harmer
â Niveth Kumar
1 hour ago
add a comment |Â
thank you Caspar Harmer
â Niveth Kumar
1 hour ago
thank you Caspar Harmer
â Niveth Kumar
1 hour ago
thank you Caspar Harmer
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
1
down vote
You can create a cron expression to execute scheduleable class from Developer console.
String hour = String.valueOf(Datetime.now().hour());
String min = String.valueOf(Datetime.now().minute());
String ss = String.valueOf(Datetime.now().second());
//parse to cron expression
String nextFireTime = ss + ' ' + min + ' ' + hour + ' * * ?';
MyScheduledJob s = new MyScheduledJob();
System.schedule('Job Started At ' + String.valueOf(Datetime.now()), nextFireTime, s);
Schedule Apex
thank you for your support
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
1
down vote
You can create a cron expression to execute scheduleable class from Developer console.
String hour = String.valueOf(Datetime.now().hour());
String min = String.valueOf(Datetime.now().minute());
String ss = String.valueOf(Datetime.now().second());
//parse to cron expression
String nextFireTime = ss + ' ' + min + ' ' + hour + ' * * ?';
MyScheduledJob s = new MyScheduledJob();
System.schedule('Job Started At ' + String.valueOf(Datetime.now()), nextFireTime, s);
Schedule Apex
thank you for your support
â Niveth Kumar
1 hour ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You can create a cron expression to execute scheduleable class from Developer console.
String hour = String.valueOf(Datetime.now().hour());
String min = String.valueOf(Datetime.now().minute());
String ss = String.valueOf(Datetime.now().second());
//parse to cron expression
String nextFireTime = ss + ' ' + min + ' ' + hour + ' * * ?';
MyScheduledJob s = new MyScheduledJob();
System.schedule('Job Started At ' + String.valueOf(Datetime.now()), nextFireTime, s);
Schedule Apex
You can create a cron expression to execute scheduleable class from Developer console.
String hour = String.valueOf(Datetime.now().hour());
String min = String.valueOf(Datetime.now().minute());
String ss = String.valueOf(Datetime.now().second());
//parse to cron expression
String nextFireTime = ss + ' ' + min + ' ' + hour + ' * * ?';
MyScheduledJob s = new MyScheduledJob();
System.schedule('Job Started At ' + String.valueOf(Datetime.now()), nextFireTime, s);
Schedule Apex
answered 1 hour ago
Devendra
4,1441320
4,1441320
thank you for your support
â Niveth Kumar
1 hour ago
add a comment |Â
thank you for your support
â Niveth Kumar
1 hour ago
thank you for your support
â Niveth Kumar
1 hour ago
thank you for your support
â Niveth Kumar
1 hour ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f235576%2fexecute-scheduled-apex-class-code-on-the-developer-console%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
