function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DevelopementDevelopement 

Run a batch using developer console

Hi,

How to run a schedule job instantly? 

I am using the below but it doesn't work and i get an error:

Line: 1, Column: 17
Argument must be an object that implements Database.Batchable

Id batchJobId = Database.executeBatch(new SendEmailsales(), 200);
Sanjay Mulagada 11Sanjay Mulagada 11
Please post your SchedulerClass or Batch Class code.
Neetu_BansalNeetu_Bansal
Hi,

Database.executeBatch can be used only for classes that implements Database.Batchable<sObject>, means if your class is batch class only than you can user Database.executeBatch.

For scheculing class, use the below code:
System.schedule('Schedule at ' + Datetime.now(), '0 0 * * * ?', new SendEmailsales());
This will schedule your code to run every hour.

Let me know, if you need any other help.

Thanks,
Neetu
Suraj Tripathi 47Suraj Tripathi 47
Hi Developement,

You are using the correct syntax. You can share your class code for finding the problem.
Id batchId = Database.executeBatch(new ClassName(), 1);

If you find your Solution then mark this as the best answer. 

Thank you!

Regards 
Suraj Tripathi