Salesforce Architecture, Org Types & Metadata
What Is Salesforce Architecture?
Salesforce is built on a multi-tenant cloud architecture.
This means many companies use the same Salesforce platform, but each company’s data is securely separated.
Real-Life Example (Easy to Remember)
Think of Salesforce like a shopping mall:
-
Mall = Salesforce platform
-
Individual shops = Salesforce Orgs
-
Security shutters = Data protection
Everyone shares the mall, but each shop’s goods are private.
What Is a Salesforce Org?
A Salesforce Org is your working environment.
Common org types:
-
Developer Org → Learning & practice
-
Sandbox Org → Testing changes safely
-
Production Org → Real business users & data
Memory Tip:
? Build → Test → Go Live
(Developer → Sandbox → Production)
What Is Metadata in Salesforce?
Metadata is configuration, not actual data.
Examples:
-
Metadata: Objects, fields, Apex classes, Flows
-
Data: Account = ABC Ltd, Contact = John Smith
Easy Rule to Remember
Metadata defines structure, data fills it.
Gist (Quick Revision)
Salesforce is a shared cloud platform.
Each company works inside its own org, and metadata controls how Salesforce behaves.
What Apex Is, When & How It Runs
What Is Apex?
Apex is Salesforce’s backend programming language.
It is used to:
-
Apply business rules
-
Automate logic
-
Control data behavior
-
Integrate with external systems
Apex is similar to Java but runs inside Salesforce with built-in safety rules called Governor Limits.
When Does Apex Run?
Apex runs automatically when:
-
A record is saved
-
A button is clicked
-
An API request is made
-
A scheduled job executes
Simple Explanation
If Salesforce needs logic, Apex runs.
How Apex Runs
-
Runs on Salesforce servers
-
Executes securely
-
Prevents system overload using governor limits
Simple Code Example
if (account.AnnualRevenue > 1000000) {
account.Rating = 'Hot';
}
This code runs automatically when an Account is saved and updates the Rating based on revenue.
Career Coach Insight
In interviews, a strong answer is:
“Apex is backend logic that enforces business rules securely inside Salesforce.”
Gist (Quick Revision)
Apex is Salesforce’s backend language that runs automatically during user actions, automation, and integrations.
Execution Context & Order of Execution
What Is Execution Context?
Execution context defines whose permissions are applied when Apex runs.
Two Execution Contexts
-
User Context
-
Respects user permissions and sharing rules
-
-
System Context
-
Ignores user permissions (default for Apex)
-
Code Example
Why Execution Context Matters
-
Prevents security issues
-
Protects sensitive data
-
Ensures compliance
Salesforce Order of Execution (Simplified)
When a record is saved, Salesforce follows this order:
-
Validation rules
-
Before triggers
-
After triggers
-
Workflow rules / Flow
-
Database commit
-
Asynchronous Apex (Future, Queueable, Batch)
Easy Memory Trick
Validate → Trigger → Automate → Commit
Real-Life Example
If a validation rule fails,
➡️ Triggers and Apex will NOT run.
Interview Tip (Very Important)
“Explain Salesforce order of execution” is a common interview question.
Knowing this shows real platform understanding, not just coding skills.
Gist (Quick Revision)
Execution context controls security, and order of execution controls timing.
Both are critical for writing correct and secure Apex code.
