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
V AnandV Anand 

Can I run Batch apex class directly on production org using developer console ?

 HI..,,,

 

I have created a Batch apex on accounts ,, and If I deployed Batch apex class to production org, can I run batch apex using developer console of production org?

 

any Help?

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard
You can indeed do this. I have done this sort of thing in the past to apply a datafix.

Be aware that there is no validation or second chance here - if the batch class makes destructive changes, for example.

All Answers

bob_buzzardbob_buzzard
You can indeed do this. I have done this sort of thing in the past to apply a datafix.

Be aware that there is no validation or second chance here - if the batch class makes destructive changes, for example.
This was selected as the best answer
MagulanDuraipandianMagulanDuraipandian

http://infallibletechie.blogspot.in/2012/05/how-to-run-batch-apex.html

 

Check this....

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

SFDC Site

If this post is your solution, kindly mark this as the solution and give Kudos.

GunnarGunnar

Sure.

 

Like this ....

 

clsMyBatchClass objMyBatchObject = new MyBatchClass();

Id batchID = Database.executeBatch(objMyBatchObject , 20);

 

assuming your class implementing batchable interface is named - clsMyBatchClass

In this case, I'm batching 20 records at a time.

 

That code works in the developer console and in another class/trigger that you want to launch the batch.