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
Diego MoreiraDiego Moreira 

Save Error: Entity is not org-accessible


I created two methods in this class but when saved generates this error message. "Save Error: Entity is not org-accessible"


Is a test method. I'm using isTest(SeeAllData=true) annotation.


So happens when I try to add two more methods class.

Anyone know what can be?





Diego Moreira

Best Answer chosen by Admin (Salesforce Developers) 

I had some minor typo in my program that led me to the same error. Not sure if it's the same case with you. I forgot to add __c when calling a custom object and got the same error. Hope this helps!

All Answers


Were you able to resolve this issue ?


Which API version are you using ? Can you switch the version to a diff. one and try ?

Diego MoreiraDiego Moreira

Hi, Thanks to responding


My API version is 24.


Is there a limit for a class of test methods?





Diego Moreira


How many test methods do you've in your class ? I would suggest you switch your API version to 23 or lesser and try.

Diego MoreiraDiego Moreira



The API was 23. 


The class contains 45 methods





Diego Moreira


45 should be ok (I don't remember the exact number per se but it's greater than 45 ). If I were you I would try the following options:

1) Go to Setup -> Develop -> Classes. You see Compile all classes option on the detail page of Classes. Click on Compile all classes and this should take couple of minutes. Try to test after this step.

2) If step 1 didn't fix your issue, try to change the API version to 21.0 and see if you can run your tests. If you can then you need to investigate what's causing your tests to not run with 23 version.

2) If step 1 or step 2 didn't fix your issue, try to run the class with less test methods and see.  I would vote for refactoring your class into two or more classes.



I had some minor typo in my program that led me to the same error. Not sure if it's the same case with you. I forgot to add __c when calling a custom object and got the same error. Hope this helps!

This was selected as the best answer
Diego MoreiraDiego Moreira

Thank apparently that was it!


It is really confusing error message, in my case  I did a spelling mistake in ApexPages.Severity and lost, i was unable to locate the line of error .


I had the same problem Save Error: Entity is not org-accessible in my IDE. I added the metadata components xxxx__c from to my IDE to solve the problem.


For my case, I instanciated a class variable,but deleted the class definition, so it couldn't resolve the type.But i thought it would give an error like : unresolve type but instead Entity is not org-accessible

Santhosh KumarSanthosh Kumar

In my case, I was using a variable named "question" but declaration was mistyped as "qestion". So looks like internally they have a variable named "question" and as there was no actual local declaration it was saying, their variable is not org-accessible.

Sebastian MuñozSebastian Muñoz

Maybe you have something like:


MyObject__c foo = new MyObject(); 


insted of


MyObject__c foo = new MyObject__c(); 



I too also recently came across "Entity is not api accessible"
It turned out that I had a "System.Runas(someUser)" statement without pre-defining the somUser to a user record.

The Original Answer is not 100% accurate:
If you leave out __c you would get an "invalid type" error and it would describe the object, unless your custom object was named similar to a standard object not enabled yet.

In my case it was due to missing settings (Email-To-Case).

Entity is not Org Accessible: I got the same error when deploying my Common Code. I had an EmailMessage handler. And in this org I had not turned on Email-to-Case.

For me: The Entity it was complaing about was EmailMessage.

I got very big test method and trying to split to 2 methods. As soon as I split it to 2, it gives me this error.

Just commented closing of first test method and second test method, it saved. But I am running into 101 SOQL error. I need to split them into 2 methods.

Any help appreciated.

You can check the blog for info about this error :