Apex Programming (Developer Path) – Complete Training Module
Apex is Salesforce’s object-oriented programming language, similar to Java, used for building custom automations and integrations.
MENU (Apex Topics)
- Apex Basics
- SOQL & SOSL
- DML Operations
- Apex Triggers
- Apex Classes
- Collections (List, Set, Map)
- Apex Best Practices (Governor Limits)
- Async Apex (Future, Batch, Queueable)
- Apex Testing (75% coverage)
1) Apex Basics (Syntax, Variables, Loops)
Title: Introduction to Apex
Description:
Apex is Salesforce’s object-oriented programming language, similar to Java, used for building custom automations and integrations.
Detailed Explanation:
- Strongly typed
- Object-oriented
- Runs on Salesforce servers
- Follows governor limits
Syntax Example:
Variables Example:
Loops Example:
2) SOQL & SOSL
Title: Querying Salesforce Data
Description:
SOQL and SOSL retrieve data from Salesforce objects.
Detailed Explanation:
SOQL (Salesforce Object Query Language)
Used to query a specific object.
Example:
SOSL (Salesforce Object Search Language)
Search across multiple objects.
Example:
3) DML Operations
Title: Insert, Update, Upsert, Delete
Description:
DML performs operations that save or modify data in Salesforce.
Examples:
Insert:
Update:
Delete:
Upsert:
4) Apex Triggers
Title: Before & After Triggers
Description:
Triggers automate actions when records are created, updated, deleted, or undeleted.
Before Insert/Update Trigger
Used to validate or modify values before saving.
Example:
After Insert/Update Trigger
Used for operations requiring the record ID or external calls.
Example:
Trigger Patterns (Best Practice)
Title: Trigger Framework
Description:
Always use one trigger per object and call a handler class.
Pattern Example:
Trigger:
Handler Class:
5) Apex Classes
Title: Writing Apex Classes
Description:
Classes contain reusable logic, functions, and business rules.
Example:
6) Collections (List, Set, Map)
Title: Apex Collection Types
Description:
Collections store multiple values and are essential for bulk processing.
List Example:
Set Example:
Map Example:
7) Apex Best Practices (Governor Limits)
Title: Writing Efficient Apex Code
Description:
Salesforce enforces limits to ensure performance.
Key Practices:
- Bulkify triggers
- Avoid SOQL inside loops
- Avoid DML inside loops
- Use maps & collections
- Use try-catch for error handling
- Callouts must be async
Bad Example (wrong):
Good Example (correct):
8) Async Apex
Title: Asynchronous Programming in Salesforce
Description:
Async Apex runs long operations in the background.
Future Methods
Used for callouts & email sending.
Batch Apex
Used for processing large datasets.
Queueable Apex
More flexible than future methods.
9) Apex Testing (75% Code Coverage)
Title: Apex Test Classes
Description:
Salesforce requires minimum 75% code coverage before deployment.
Best Practices:
- Use @isTest
- Use Test.startTest() & Test.stopTest()
- Do not use real org data
- Create test data inside the test class