Understanding the Salesforce Security Model
By the end of this lesson, you'll be able to:
- Describe the layers of the Salesforce security model, from org-wide access down to individual records
- Explain the difference between object-level, field-level, and record-level security
Prerequisites: None — this is the first lesson in the course.
The three layers of data security
Every piece of data in Salesforce is protected by three independent layers:
- Object-level — can the user perform Create, Read, Update, or Delete on this type of record at all? Controlled by Profiles and Permission Sets.
- Field-level — of the fields on a record they can see, which ones can they actually view or edit? Controlled by Field-Level Security (FLS).
- Record-level — of the individual records for an object they have access to, which specific rows can they see? Controlled by Organization-Wide Defaults, role hierarchy, and sharing rules.
Layers are additive, never subtractive
A user must pass all three layers to see a piece of data — if any single layer denies access, that's the final answer, no matter how permissive the other two are.
Record-level sharing can only ever widen access above the Organization-Wide Default baseline; it can never be used to restrict a user below it, and it can't override an object or field permission the user simply doesn't have.
Checking object-level access with Schema describe
Schema.DescribeSObjectResult accountDescribe = Account.sObjectType.getDescribe();
System.debug('Can current user create Accounts? ' + accountDescribe.isCreateable());
Schema describe calls let Apex check object-level permissions for the running user at runtime, before attempting a DML operation.
Exercise
Using Schema describe methods, write a line of Apex that prints whether the running user can delete Opportunity records.
Show hint
Opportunity.sObjectType.getDescribe().isDeletable()
Understanding the Salesforce Security Model — Quick Check
My Notes
Log in to keep private notes on this lesson.
Questions about this lesson
No questions yet — be the first to ask.
Log in to ask a question about this lesson.
Summary
Salesforce security is enforced in layers — object permissions, field-level security, and record-level sharing all apply together, and a user needs to pass every layer to see or edit a piece of data.