





















































In the article by Rakesh Gupta and Sagar Pareek, authors of Salesforce.com Customization Handbook, we will discuss Organization-Wide Default (OWD) and various ways to share records. We will also discuss the various security settings in Salesforce. The following topics will be covered in this article:
(For more resources related to this topic, see here.)
Organization-Wide Default is also known as OWD. This is the base-level sharing and setting of objects in your organization. By using this, you can secure your data so that other users can't access data that they don't have access to. The following diagram shows the basic database security in Salesforce. In this, OWD plays a key role.
It's a base-level object setting in the organization, and you can't go below this. So here, we will discuss OWD in Salesforce.
Let's start with an example. Sagar Pareek is the system administrator in Appiuss. His manager Sara Barellies told him that the user who has created or owns the account records as well as the users that are higher in the role hierarchy can access the records.
Here, you have to think first about OWD because it is the basic thing to restrict object-level access in Salesforce. To achieve this, Sagar Pareek has to set Organization-Wide Default for the account object to private.
To change or update OWD for your organization, follow these steps:
The following table describes the various types of OWD access and their respective description:
OWD access |
Description |
Private |
Only the owner of the records and the higher users in the role hierarchy are able to access and report on the records. |
Public read only |
All users can view the records, but only the owners and the users higher in the role hierarchy can edit them. |
Public read/write |
All users can view, edit, and report on all records. |
Public read/write/ transfer |
All users can view, edit, transfer, and report on all records. This is only available for case and lead objects. |
Controlled by parent |
This says that access on the child object's records is controlled by the parent. |
Public full access |
This is available for campaigns. In this, all users can view, edit, transfer, and report on all records. |
You can assign this access to campaigns, accounts, cases, contacts, contracts, leads, opportunities, users, and custom objects. This feature is only available for Professional, Enterprise, Unlimited, Performance, Developer, and Database Editions.
Whenever you buy your Salesforce Instance, it comes with the predefined OWD settings for standard objects. You can change them anytime by following the path Setup | Administer | Security Controls | Sharing Settings. The following table describes the default access to objects:
Object |
Default access |
Account |
Public read/write |
Activity |
Private |
Asset |
Public read/write |
Campaign |
Public full access |
Case |
Public read/write transfer |
Contact |
Controlled by parent (that is, account) |
Contract |
Public read/write |
Custom Object |
Public read/write |
Lead |
Public read/write transfer |
Opportunity |
Public read only |
Users |
Public read only and private for external users |
Let's continue with another example. Sagar Pareek is the system administrator in Appiuss. His manager Sara Barellies told him that only the users who created the record for the demo object can access the records, and no one else can have the power to view/edit/delete it.
To do this, you have to change OWD for a demo object to private, and don't select Grant Access Using Hierarchy.
When you select the Grant Access Using Hierarchy field, it provides access to people who are above in the role hierarchy.
To open the record-level access for a group of users, roles, or roles and subordinates beyond OWD, you can use Sharing Rule. Sharing Rule is used for open access; you can't use Sharing Rule to restrict access.
Let's start with an example where Sagar Pareek is the system administrator in Appiuss. His manager Sara Barellies wants every user in the organization to be able to view the account records but only a group of users (all the users do not belong to the same role or have the same profile) can edit it.
To solve the preceding business requirement, you have to follow these steps:
What we did to solve the preceding business requirement is called Sharing Rule. There is a limitation on Sharing Rules; you can write only 50 Sharing Rules (criteria-based) and 300 Sharing Rules (both owner- and criteria-based) per object. The following are the types of Sharing Rules in Salesforce:
Click on the Sharing button and it will redirect you to a new window. Now, click on Add and you are ready to share records with the following:
Select the access type for each object and click on Save. It will look like what is shown in the following screenshot:
The Lead and Case Sharing buttons will be enabled when OWD is Private, Public Read Only, and Public Read/Write.
Apex-managed sharing is a type of programmatic sharing that allows you to define a custom sharing reason to associate with your programmatic share. Standard Salesforce objects support programmatic sharing while custom objects support Apex-managed sharing.
Data on fields is very important for any organization. They want to show some data to the field-specific users. In Salesforce, you can use Field-Level Security to make fields hidden or read-only for a specific profile. There are three ways in Salesforce to set Field-Level Security:
Let's start with an example where Sagar Pareek is the system administrator in Appiuss. His manager Sara Barellies wants to create a field (phone) on an account object and make this field read-only for all users and also allowing system administrators to edit the field.
To solve this business requirement, follow these steps:
If you select Read-Only, the visible checkbox will automatically get selected.
Similarly, in Field-Level settings, you can also achieve the same results from a profile. Let's follow the preceding business use case to be achieved through the profile. To do this, follow these steps:
We can achieve the same outcome by using field accessibility. To do this, follow these steps:
For security purposes, Salesforce provides an option to set password policies for the organization. Let's start with an example. Sagar Pareek, the system administrator of an organization, has decided to create a policy regarding the password for the organization, where the password of each user must be of 10 characters and must be a combination of alphanumeric and special characters. To do this, he will have to follow these steps:
In this article, we have gone through various security setting features available on Salesforce. Starting from OWD, followed by Sharing Rules and Field-Level Security, we also covered password policy concepts.
Further resources on this subject: