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
XXXXXX 

Can I Create an Apex Class in An Enterprise Edition Org?

If so, how? (The New button is missing.) I am a system administrator for this org and my user account has the Development Mode checkbox checked.

 

If not, why not?

 

TIA,

 

John

Best Answer chosen by Admin (Salesforce Developers) 
iCloudiusiCloudius

This from the help & training link regarding Apex: "You can add, edit, or delete Apex using the Salesforce user interface only in a Developer Edition, a Salesforce Enterprise Edition trial organization, or sandbox organization. In a Salesforce production organization, you can only make changes to Apex by using the metadata API

deploy call, the Force.com IDE, or the Force.com Migration Tool."

 

 So you'll need to use a different tool if you're in the production environment.

All Answers

iCloudiusiCloudius

This from the help & training link regarding Apex: "You can add, edit, or delete Apex using the Salesforce user interface only in a Developer Edition, a Salesforce Enterprise Edition trial organization, or sandbox organization. In a Salesforce production organization, you can only make changes to Apex by using the metadata API

deploy call, the Force.com IDE, or the Force.com Migration Tool."

 

 So you'll need to use a different tool if you're in the production environment.

This was selected as the best answer
XXXXXX

Thanks for the heads-up. I have posted an idea suggesting that perhaps giving us access to the native SF IDE from an enterprise org would be helpful.

 

It is clearly possible that we can add a new Apex class to an enterprise org via channels you mentioned -- why on earth can't we just add an Apex class directly? What possible benefit could there be for SF to keep us from doing this? They had to write code to prevent us from using the native tools already present.

 

Is it test coverage? That's the only possible thing I can think of ...

shillyershillyer

That's exactly why. Enterprise Edition (along with GE, PE and UE) are production orgs. They contain mission-critical data for your businesses. Allowing Apex Code to be authored directly in these orgs without thoroughly testing could jeopardize your org. Therefore we provide development environments like DE or Sandbox to develop and test your Apex Code, and then later deploy to production once adequate test coverage is met. Go here for more Best Practices on testing Apex Code.

 

Hope that helps,

Sati

XXXXXX

But I can already author Apex code against these production environments, using Eclipse. Now that I have finally found a Java/Eclipse stack that is compatible with both Vista and the Force.com IDE, I am writing Apex directly against my production org without any test coverage whatsoever.

 

This doesn't make sense. If test coverage is that important, I shouldn't be able to upload Apex code to my production org with having, and running, test methods.

 

(Of course, I am going to write test coverage -- I always shoot for 100% -- but that's not the point.)

 

Just my two cents ...

shillyershillyer

I'm interested with what's going on here, can you please email me offline.

 

shillyer@salesforce.com

 

Thanks,

Sati

mshelmanmshelman
From Eclipse IDE it is possible to save Apex classes to production orgs without any test coverage.
JonPJonP

The production test coverage measurements apply to all your Apex in your org, not to any one particular class.  If you have a bunch of big classes with 100% coverage, then you can add a new small class with 0% coverage, as long as the overall coverage exceeds 75% of all lines.

 

Note that in production triggers, unlike classes, require at least 1% coverage--meaning each trigger must be invoked by at least one test.

mshelmanmshelman
Yes but what we're talking about here is production orgs with many classes and no test coverage whatsoever.
Message Edited by mshelman on 05-04-2009 11:32 AM
JonPJonP

Is it possible the organization you're using is a free Developer Edition, or a *trial* Enterprise Edition?

 

These organizations types are accessed from the production login page (www.salesforce.com), as opposed to the Sandbox login page (test.salesforce.com), but they do not enforce the production test coverage requirements.

 

 

 

XXXXXX

Just for the record, I cannot do this anymore. I suspect there was a bug in v15 of the Force.com IDE.

 

I was in an Enterprise org, not a trial or dev org, and whenever I saved changes to my class, they were automatically deployed to my org. As you can tell from my initial posts, I am very new at this -- I didn't realize that this behavior was abnormal and, when I suddenly lost the ability to "deploy" using the Save button (last night about 6pm), it threw me for a loop until I found the Deploy to Server menu item.

JonPJonP
This behavior is enforced on the server, by the Metadata API, and not in the Force.com IDE.  The IDE does the same thing regardless of what kind of organization you're connecting to, calling the deploy() API verb on save or Deploy to Server.