1

I'm using REST API to create Apex Class in Salesforce org. It worked in my testing for multiple orgs, but for a customer I'm getting this error -

Can not create Apex Class on an active organization.

To create the apex class using API, I'm just creating a object of type ApexClass with payload having name and body of class.

I see that Salesforce doesn't allow creation of classes in a production org directly, but it worked in multiple orgs I tested with, so I think it's allowed to be created by the API.

Is there a org setting that might be preventing this?

6

You can only create a class in Organizations which are a Sandbox or Developer Edition. For any other type, you will need to deploy the class using the Metadata API.

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.