Skip to main content
Bounty Ended with 50 reputation awarded by CommunityBot
added 29 characters in body
Source Link

I don't believe that you can.

Instead, consider protecting access to your batcheable class and provide a service class that calls the constructor for you, passing in the batch size, and then you call

global static class myService {
    global static void RunMyBatch(Integer batchSize) {
        myBatch theBatch = new myBatch (batchSize); // Batch size in constructor
        Database.executeBatch(theBatch, batchSize);
    }
}

I don't believe that you can.

Instead, consider protecting access to your batcheable class and provide a service class that calls the constructor for you, passing in the batch size, and then you call

global static class myService {
    global static void RunMyBatch(Integer batchSize) {
        myBatch theBatch = new myBatch (batchSize);
        Database.executeBatch(theBatch, batchSize);
    }
}

I don't believe that you can.

Instead, consider protecting access to your batcheable class and provide a service class that calls the constructor for you, passing in the batch size, and then you call

global static class myService {
    global static void RunMyBatch(Integer batchSize) {
        myBatch theBatch = new myBatch (batchSize); // Batch size in constructor
        Database.executeBatch(theBatch, batchSize);
    }
}
Source Link

I don't believe that you can.

Instead, consider protecting access to your batcheable class and provide a service class that calls the constructor for you, passing in the batch size, and then you call

global static class myService {
    global static void RunMyBatch(Integer batchSize) {
        myBatch theBatch = new myBatch (batchSize);
        Database.executeBatch(theBatch, batchSize);
    }
}