Standard Before Custom
เนื้อหานี้ยังไม่มีในภาษาของคุณ
Module 1 of 6 in the chapter Reviewing a Security and Sharing Model, chapter 23 of Securing Salesforce: Sharing and Visibility. Each module stands on its own.
The question this module answers: When you review a security model, what’s the first thing you look for?
The last tool, not the first
Section titled “The last tool, not the first”When I prepare people for the review board, I tell them the same thing every time: don’t get lazy and Apex-share everything. Use native Salesforce sharing everywhere you can. Only go to code when there’s no other way.
Chapter 11 module 1 turned that into questions for record sharing: do the defaults do it, does a rule, do teams or territories, does the data model, and only then does code write the shares. This chapter starts the review of the whole model with the same rule, because it holds at every layer of the course, not just for records.
So the first thing I look for in any security model is simple. Where did someone build something the platform already does?
The same rule at every layer
Section titled “The same rule at every layer”Here’s the course, layer by layer, with the platform’s own mechanism and the custom one it should come before.
| The layer | Reach for first | Reach for last | Where it’s taught |
|---|---|---|---|
| What people may do | Permission sets and groups, built from each subsystem’s levels | Permission checks written into code | Chapter 3 |
| Fields | Field-level security | Hiding on a page layout, which isn’t security; a component that shows a locked field | Chapter 4 |
| Records | Defaults, hierarchy, rules, teams, territories, the data model | Shares written by code or a flow | Chapters 5 to 11 |
| Taking access away | Restriction and scoping rules | Filters in custom code | Chapter 16 |
| Outside users | External defaults, roles, sharing sets, share groups | Custom portal logic | Chapters 14 and 15 |
| Code | with sharing, user mode | without sharing, system mode | Chapter 17 |
| Encryption | Shield Platform Encryption | The Apex Crypto class | Chapter 18 |
| Watching | Event monitoring, transaction security, the default policies | Custom logging | Chapter 19 |
| Agents | The agent user, Agent Access, actions scoped to the verified customer | Actions that read past their user | Chapter 20 |
Read down the last column and you’ve read the course. Every chapter taught both columns, and every chapter said the same thing about the order.
Why standard wins
Section titled “Why standard wins”It isn’t a matter of taste. The platform’s mechanism keeps itself right, and custom work doesn’t.
When a rule shares a record, Salesforce keeps it current when the record changes, when the owner changes, when a new user joins the role. When code shares it, all of that is your job (chapter 11 module 1). The same is true at every layer:
- It stays right when things change. Records, users, roles and releases all move. The platform’s mechanism moves with them; custom work moves only when someone remembers to change it.
- It can be seen. A permission set, a rule, a restriction rule shows up in Setup, in the access summaries and in the evidence tools from chapter 13. A share written by code sits in a table, and a check written in code sits in a class.
- It’s tested by Salesforce. Every release. Your custom version is tested by you, when you remember.
- The next architect understands it. Somebody else will review this model one day. A standard model reads like the course. A custom one reads like a puzzle.
That’s why the review starts here. Every custom piece is a place where the model can drift without anyone noticing.
When custom is the right answer
Section titled “When custom is the right answer”Sometimes the platform can’t do it, and custom is right. Here’s the case I use in class, and I’ve seen it on more than one exam: a HIPAA-level field that only the assigned rep may see, on a record other reps can still open (chapter 4 module 5).
Field-level security works by profile and permission set, not by record. So you lock the field down for everyone, because it needs to be secure. Then you build a component that runs in system context and shows the value only when the user is the assigned rep. It works. And it costs: it only works for display, so the edit has to happen somewhere else too, and now you own that component, its tests and its reason.
That’s what custom looks like when it’s right: standard tried first, at every layer, and only the gap built by hand.
Write the exception down
Section titled “Write the exception down”So every custom piece in a model gets three lines in the review, the same way chapter 17 module 7 writes down every system-mode class:
- What the standard mechanism couldn’t do, in one sentence.
- Who owns it now, and who owns it next year.
- How it’s tested, and what reruns the test.
If nobody can write the first line, it isn’t an exception. It’s a shortcut, and the review sends it back.
Test knowledge. Know to prefer declarative, platform-maintained mechanisms over custom code at every layer: permission sets over code checks, field-level security over hiding, sharing rules and the hierarchy over Apex managed sharing, restriction rules over custom filters,
with sharingand user mode over system mode, Shield over the Crypto class. Know what programmatic sharing costs: it must be maintained when records, users and the rules change. This supports the exam’s objectives across the course, from OBJ-1 to IMP-3. A likely area, not a known question.
What an architect decides here
Section titled “What an architect decides here”- For each layer of the model, whether the platform’s mechanism was tried first.
- Which custom pieces stay, each with what standard couldn’t do, its owner and its test.
- Which custom pieces go back to standard, and when.
Beyond the exam: what AI changes. An AI assistant reaches for code first, because code is what it writes best. Ask it the standard question before you accept its answer: is there a permission set, a rule or a setting that already does this?
Explore
Section titled “Explore”- Don’t Apex-Share Everything, chapter 11 module 1
- Layer by Layer: The Assigned-Rep Field, chapter 4 module 5
- Reviewing Code as an Architect, chapter 17 module 7
