I want to know on custom object what is the sharing setting whether is Private, Public or Public/Read/Write.

I have looked at the sharing table like CustomObject__Share SELECT Id,ParentId,UserOrGroupId,RowCause,AccessLevel FROM CustomObject__Share I did not get any rows.

I know that I can use Organization but this will NOT have any customObject information.

Select Id, DefaultAccountAccess, DefaultContactAccess, DefaultLeadAccess, DefaultOpportunityAccess from Organization

How would you go find what are the sharing settings on customObject?

1 Answer 1


There's two basic ways to do so: via the Metadata API or the Tooling API.

As a Tooling API query, you can do something like:

SELECT SharingModel FROM CustomObject WHERE DeveloperName = 'MyCustomObject'

Which will give you a value of None, Read, Edit, or ControlledByParent (for detail objects in a master-detail relationship).

Via the Metadata API is a similar experience. Prepare a package.xml or retrieveMetadata call that includes the custom object in question. The values there are sharingModel and externalSharingModel (if enabled). The possible responses are Private, Read, ReadWrite, ReadWriteTransfer, FullAccess, and ControlledByParent.

Note that you can differentiate between Edit and Read/None types simply by doing a describe call; if MyCustomObject__Share does not exist, it's Public Read/Write, otherwise its one of the other two values.

The Share table doesn't tell you what the default settings are, it tells you which users or groups have enhanced (higher than default) privileges, such as when a user clicks on the Sharing button to add additional members to the record's share.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .