Skip to content
Tutorials Center
My learning

Topics

Salesforce Apex and LWC Tutorial

Learn Salesforce Apex and LWC step by step: 36 lessons in 9 chapters with examples, quizzes, diagrams and projects.

Start learning →

of lessons completed

Getting Started

  1. 1 What Is Salesforce Apex? Learn what Apex is, where it runs inside Salesforce, what it is used for, and how it compares with Java, Flows and Lightning Web Components.
  2. 2 Setting Up Your Developer Environment Set up a free Salesforce Developer Edition org, the Developer Console, VS Code with Salesforce extensions and the sf CLI so you can write Apex today.
  3. 3 Your First Apex Code and Debug Logs Write and run your first Apex with Execute Anonymous, print values with System.debug, read debug logs and understand log levels, with Java stand-ins.
  4. 4 Execution Model and Governor Limits Understand Apex transactions, the order of execution and the key governor limits (SOQL, DML, CPU, heap) and how to stay inside them, with Java stand-ins.

Apex Basics

  1. 5 Variables and Data Types in Apex Learn Apex variables and primitive data types (Integer, Long, Decimal, Boolean, String, Id), null handling, constants with final and type conversion.
  2. 6 Strings, Numbers and Dates in Apex Work with Apex Strings, Decimals and the Math class, and build, compare and format Date and Datetime values, with runnable Java stand-ins for the logic.
  3. 7 Collections: Lists, Sets and Maps in Apex Master Apex collections: ordered Lists, unique Sets and key-value Maps, with the methods, iteration patterns and bulk-friendly idioms every trigger relies on.
  4. 8 Control Flow and Loops in Apex Learn Apex decision and loop statements: if/else, ternary, switch on values and types, for, for-each, while, do-while, break and continue, with stand-ins.
  5. 9 SObjects and Fields in Apex Understand Salesforce objects, records and fields as Apex SObjects: standard and custom objects, field access, relationships, generic SObjects and the Schema class.

SOQL and DML

  1. 10 SOQL Basics Learn Salesforce Object Query Language: SELECT fields FROM an object, LIMIT, inline queries in Apex, single-record queries and bind variables, with stand-ins.
  2. 11 Filtering and Sorting with SOQL Filter SOQL results with WHERE, operators, LIKE, IN, date literals and ORDER BY, plus LIMIT and OFFSET paging, NULLS handling and dynamic filters, with stand-ins.
  3. 12 Relationship Queries in SOQL Query related records in SOQL: child-to-parent dot notation, parent-to-child subqueries, custom relationship names, semi-joins and anti-joins, with Java stand-ins.
  4. 13 Aggregate SOQL Summarise data with SOQL aggregate functions COUNT, SUM, AVG, MIN and MAX, GROUP BY, HAVING, ROLLUP and AggregateResult, with Java stand-ins.
  5. 14 DML: Insert, Update, Delete and Undelete Save data with Apex DML statements insert, update, upsert, delete and undelete, bulk lists, Database methods with partial success and error handling, with stand-ins.

Triggers

  1. 15 Apex Trigger Basics Learn what Apex triggers are, the trigger syntax, before and after triggers, the seven events, when to use each, and the order of execution, with Java stand-ins.
  2. 16 Trigger Context Variables Use Trigger.new, Trigger.old, Trigger.newMap, Trigger.oldMap and the isInsert, isBefore and operationType flags to detect what changed in an Apex trigger.
  3. 17 Bulkification in Triggers Learn to bulkify Apex triggers so they handle 200 records safely: collect Ids, query once, group with maps, update in bulk, with runnable Java stand-ins.
  4. 18 The Trigger Handler Pattern Organise Apex trigger logic with the handler pattern: a logic-free trigger, a handler class with before and after methods, a base class, recursion control, with stand-ins.

Classes and Testing

  1. 19 Apex Classes, Interfaces and Access Modifiers Learn how Apex classes, constructors, interfaces, access modifiers and sharing keywords work, with real Apex code and runnable Java stand-ins for the design ideas.
  2. 20 Apex Inheritance, Virtual Methods and Abstract Classes Learn Apex inheritance: virtual and abstract classes, override, super, polymorphism and when to prefer composition, with real Apex and runnable Java stand-ins.
  3. 21 Apex Test Classes, Assertions and Code Coverage Write Apex unit tests: @isTest, System.Assert methods, Test.startTest and stopTest, bulk and negative tests, and the 75 percent coverage rule, with a Java test-harness stand-in.
  4. 22 Apex Test Data Factories, @TestSetup and Mocking Build reusable Apex test data with factories and @TestSetup, and isolate code with the Stub API and interface-based test doubles, shown in Apex and Java stand-ins.

Asynchronous Apex

  1. 23 Apex Future Methods and Asynchronous Basics Learn asynchronous Apex and @future methods: when to go async, the rules and limits, callouts from triggers, and a runnable Java stand-in of a background job queue.
  2. 24 Queueable Apex: Chaining, Job Ids and Finalizers Learn Queueable Apex: implement the interface, pass sObjects, chain jobs, track the job Id and use finalizers, with Apex listings and a runnable Java job-chain stand-in.
  3. 25 Batch Apex: start, execute, finish and Scope Size Learn Batch Apex: the Database.Batchable interface, start, execute and finish, scope size, Database.Stateful, chaining and testing, with a runnable Java chunking stand-in.
  4. 26 Scheduled Apex and Cron Expressions Learn Scheduled Apex: implement Schedulable, write cron expressions, schedule from code or Setup, launch batches on a timer and test schedules, with a runnable Java cron stand-in.

Lightning Web Components

  1. 27 Lightning Web Components: Your First Component Learn Lightning Web Components: the bundle files, HTML templates, lwc:if, for:each, public properties with @api and the meta XML, with a runnable JavaScript template stand-in.
  2. 28 LWC Reactivity, Events and Component Communication Understand LWC reactive properties, event handlers, CustomEvent from child to parent, @api methods and the Lightning Message Service, with runnable JavaScript stand-ins.
  3. 29 Calling Apex from LWC with @wire and Imperative Calls Learn how a Lightning Web Component calls Apex: @AuraEnabled(cacheable=true), @wire, imperative calls, error handling and refreshApex, with a runnable JavaScript stand-in.
  4. 30 LWC Lifecycle Hooks and Jest Testing Learn the LWC lifecycle: constructor, connectedCallback, renderedCallback and disconnectedCallback, then test components with Jest, with runnable JavaScript stand-ins.

Integration and Deployment

  1. 31 Making REST Callouts from Apex and Mocking Them Call external REST APIs from Apex with Http, HttpRequest and Named Credentials, parse JSON, handle errors and test with HttpCalloutMock, plus a runnable Java HTTP stand-in.
  2. 32 Exposing Apex as a REST Service with @RestResource Build a custom REST endpoint in Apex with @RestResource, @HttpGet, @HttpPost, RestContext, status codes and tests, with a runnable Java router stand-in.
  3. 33 Deploying Apex and LWC with the Salesforce CLI Learn source-driven Salesforce development: SFDX project layout, scratch orgs, sf project deploy, running Apex tests, package.xml and CI/CD, with a Java deploy-order stand-in.

Projects and Practice

  1. 34 Project: A Trigger Handler Framework Build a reusable Apex trigger handler framework: a base class, one trigger per object, recursion guard, bypass switch and tests, with a runnable Java dispatcher you can extend.
  2. 35 Project: A Nightly Data Cleanup Pipeline Build a nightly Apex pipeline: a Schedulable launches a stateful batch that archives stale records, collects failures and chains a queueable summary, with tests and a Java simulation.
  3. 36 Practice: Governor Limits, Patterns and Interview Questions Practise Apex governor limits, bulkification patterns, order of execution and common interview questions, with exercises and a runnable Java limit-meter stand-in.