I am a beginner to APEX, kindly provide pdf or links from where i can learn from scratch.
#Apex #Salesforce Developer #Beginner Developer
If you're completely new to Apex, I would recommend learning it step by step rather than trying to learn everything at once.
A good learning path is:
1. Programming fundamentals
- Variables and data types
- If/else and switch
- Loops
- Methods
- Classes and objects
- Collections: List, Set, Map
2. Salesforce fundamentals
- sObjects
- Object relationships
- SOQL
- SOSL
- DML
- Database methods
- Exception handling
Salesforce's Apex Basics & Database module is a good starting point. Apex Basics & Database — Trailhead
For SOQL, this is particularly useful: SOQL Queries in Apex — Trailhead
3. Apex classes
Learn how to build reusable classes and methods. Then understand:
- public, private, protected
- static
- Constructors
- Interfaces
- Inheritance
- Encapsulation
4. Triggers
After you are comfortable with classes, SOQL and DML, learn triggers.
Focus on:
- Trigger context variables
- Before vs after triggers
- Trigger handler pattern
- Bulkification
- Recursion control
- Moving business logic into classes
Salesforce recommends understanding Apex basics, SOQL and database concepts before triggers.
5. Governor Limits & Bulkification — VERY IMPORTANT
This is one of the biggest differences between normal programming and Salesforce development.
Always remember:
❌ Don't put SOQL inside a loop
❌ Don't put DML inside a loop
Instead:
List<Account> accounts = [
SELECT Id, Name
FROM Account
WHERE Id IN :accountIds
];
update accounts;
Learn to design your code for 1 record and 200 records from the beginning. Salesforce specifically recommends bulk operations to avoid governor-limit problems.
6. Apex Testing
Learn:
- @IsTest
- Test data creation
- Test.startTest()
- Test.stopTest()
- System.assert
- Positive/negative tests
- Bulk tests
- Testing exceptions
- Mock callouts
Don't write tests just to achieve 75% coverage. Test the actual business requirements and edge cases. Salesforce currently requires at least 75% Apex coverage for deployment, with every trigger having coverage.
7. Asynchronous Apex
Then move to:
- Queueable Apex
- Batch Apex
- Scheduled Apex
- Future methods
Understand when and why to use each one rather than just memorizing syntax.
8. Integration
Finally learn:
- HTTP callouts
- REST APIs
- JSON
- Named Credentials
- External Credentials
- Apex REST
- Authentication
- Callout testing with mocks
Recommended order
Programming Basics → Collections → sObjects → SOQL → DML → Classes → Exception Handling → Governor Limits → Bulkification → Triggers → Testing → Queueable → Batch → Scheduled Apex → REST/Callouts → Architecture
I would follow roughly 30% theory + 70% hands-on practice.
For example, don't just read about SOQL. Create Accounts, Contacts and Opportunities and write 20–30 queries yourself.
Official resources
- Apex Developer Guide — Salesforce — comprehensive reference covering Apex fundamentals, testing, governor limits, triggers, asynchronous Apex and more.
- Apex Basics & Database — Trailhead
- Apex Triggers — Trailhead
- Apex Testing — Trailhead
- Asynchronous Apex — Trailhead
- Apex Integration Services — Trailhead
Most importantly, build small projects while learning. For example: build an Opportunity management class → add a trigger → bulkify it → write test classes → add Queueable processing → expose functionality through a REST API.
That will teach you much faster than reading Apex syntax alone.