Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question
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(); –  Lex 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. –  Lex Jan 14 '13 at 10:16

1 Answer 1

up vote 8 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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