Is it possible to know, via apex code, if a certain object is Private, Public Read-Only or Public Read/Write?
|
For the Standard object, you can use Organization object to achieve this, query like, Organization org = [Select Id, DefaultAccountAccess, DefaultContactAccess, DefaultLeadAccess, DefaultOpportunityAccess from Organization]; System.debug(org); Query this object to obtain information about an organization's settings. Only one organization object exists per organization. for the details, see the doc, http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_organization.htm |
|||
|
|
Guess this should help you : SELECT Id,ParentId,UserOrGroupId,RowCause,AccessLevel FROM ObjectApiName__Share |
|||
|
|
Another way to test for sharing of custom objects is to check the global describe Map.
As you have already discovered, this is only for custom objects, @JiaHu's answer explains how to get the sharing level of a standard object. |
|||
|
|
