9

My project has a batch class. Before I package my project into a managed beta, I test I can run the batch class from the Developer console.

My_Batch b = new My_Batch();
Database.executeBatch(b);

Everything runs.

However, when I install this managed beta into a new org and try the same code from a developer console, I get:

Invalid type: My_Batch

What is not ok to run the batch class from the managed beta? Is there any other way I can run it?

Thanks.

3
  • 1
    I think you need to prefix the My_Batch with the namespacesprefix of the package: [namespace].My_Batch b = new [namespace].My_Batch(); or [namespace]__My_Batch b = new [namespace]__My_Batch(); Commented Jan 14, 2013 at 10:03
  • @Lex [namespace].My_Batch b = new [namespace].My_Batch(); works. Thanks. I'll accept it as answer.
    – dublintech
    Commented Jan 14, 2013 at 10:13
  • Great! I've created an answer. Commented Jan 14, 2013 at 10:16

1 Answer 1

14

You need to prefix the My_Batch with the namespacesprefix of the package: [namespace].My_Batch b = new [namespace].My_Batch();

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .