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.

  • 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(); – rael_kid Jan 14 '13 at 10:03
  • @Lex [namespace].My_Batch b = new [namespace].My_Batch(); works. Thanks. I'll accept it as answer. – dublintech Jan 14 '13 at 10:13
  • Great! I've created an answer. – rael_kid Jan 14 '13 at 10:16
14

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.