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
jbozajboza 

Need to develop new apex class

I am trying to develop a new apex class in a production environment and it won,t let me. How to use the developer console and migrate into the production. I am lost but the code I have works since I have tested elsewhere. Can somebody walk me through this?

Prashant TiwariPrashant Tiwari

Hi,

 

Only Developer Edition, Sandbox, and Trial organizations have the ability to create, edit, and delete Apex classes and triggers directly in the Salesforce CRM user interface. Unlimited Edition and Enterprise Edition production organizations can execute Apex and can view Apex in the user interface, but modifying Apex in the user interface is not allowed.

 

The Apex classes and triggers should first be written in a Developer Edition, Sandbox, or Trial organization along with the appropriate test methods that test at least 1% of triggers and 75% of classes. To deploy Apex into a production organization, a user with the Author Apex permission must deploy the triggers and classes using either the compileAndTest() or deploy() Metadata API methods which can be accessed with either the Apex Development Tool based on Apache ANT or the Force.com IDE based on Eclipse.

 

You can use Changeset also to achieve this, you can go throgh the below link for steps:

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_qs_deploy.htm

 

 

mark it as solved if the solution worked as it might help others..!!

 

Thanks,

 

Prashant Tiwari

 

Satish_SFDCSatish_SFDC
You cannot create classes or apex code in production environments. This code has to be created on a developer edition or trial org or a sandbox and then deployed to production via Changesets, Eclipse IDE or ANT.

Regards,
Satish Kumar
jbozajboza

If I  have it work in developer do I need to test before deploying

Satish_SFDCSatish_SFDC
No but while deploying to production the tests are run automatically to ensure code coverage in production.
That said it is a good practice to test before deploying.

Regards,
Satish Kumar
jbozajboza

I am confused as test. Do I need to develop a test class or page?

Satish_SFDCSatish_SFDC
You need to develop test classes.

Regards,
Satish Kumar