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
umutdoganumutdogan 

How to Get Sharing Settings?

Hi,

In my applications I want to use Salesforce sharing which is accessible from Setup -> Administration Setup -> Security Controls -> Sharing Settings.

 

I set default sharing settings for my custom object. Ialso set some custom sharing rules for that object. I want to get these settings and based on these settings i want to display/hide some fields in my application. I searched a lot but couldn't find how to get these settings.

 

For example for an account, user may choose Private, Public Read Only or Public Read/Write for Default Access and Use Hierarchies/ Do not use Hierarchies for Hierarchies. Than also for that account he may set CEO can display Standard User objects with Pulbic Read option from TestObject sharing rules. I want to get these configurations for each user and make my logic based on these settings.

fgwarbfgwarb

I don't know where the settings are stored, but you can view the sharing settings for individual records in their Share table.

 

For custom objects they are named CustomObjectName__Share.

Standard objects are ObjShare.

 

umutdoganumutdogan

But how can we get general sharing settings. And also is there SOQL (or function) examples to retrieve these settings from custom object's sharing objects. Which fields are important to see the sharing of an object for a user? When I search using sForce explorer it is displaying that it is visible to ALL.

 

Thanks,

Umut