You need to sign in to do that
Don't have an account?
chuk2
Entity is not org-accessible in apex controller
I have a visualforce page that creates a new user and contact, I'm updating the controller class to also add a sharing rule for the new user. However, I am now getting the error "Entity is not org-accessible". I'm told this error is due to typing in an entity wrong, like only 1 _ or such but I simply can not find the typo in my code. Any help or ideas?
here is the new code that is causing the error.
Volunteer__Share vShare = new Volunteer__Share(); vShare.ParentId = vID; // The volunteer record that we need to give access to. vShare.UserOrGroupId = u.Id; // The user to which access is being granted vShare.AccessLevel = 'Edit'; vShare.RowCause = Schema.Volunteer__Share.RowCause.Contact__c; Database.SaveResult insertResults = Database.insert(vShare,false); // The false parameter allows for partial processing if multiple records passed into the operation. // Error handling - did the insert work as intended. if(insertResults.isSuccess()){ // Indicates success System.debug('Recrords for BookShare inserted successfully'); }
I found an older post with the answer to my problem... The share records only exist when the object sharing model is set to private. All I had to do was change the sharing model for that object and the error disappeared.
All Answers
I found an older post with the answer to my problem... The share records only exist when the object sharing model is set to private. All I had to do was change the sharing model for that object and the error disappeared.
The issue was that we had changed the model in our dev sandbox and updated the code to create sharing rules via Apex in the test class, but the sharing model didn't get changed before attempting to deploy. So you are spot-on on what the problem is (Sharing objects do not exist if sharing model is not "Private").