Apex

Learn the fundamentals of the Apex programming language.

Learn Apex Programming with Swapnil:

📌 Day 1: Introduction to Apex

  1. What is Apex? Apex is Salesforce’s object-oriented programming language.

It is strongly typed (you must define variable types).

It runs on Salesforce servers, inside the Lightning Platform.

Apex is used to:

Automate business logic (Triggers, Classes).

Integrate with external systems (via API callouts).

Create complex customizations not possible with just point-and-click tools (Flows, Process Builder).

Think of it like Java for Salesforce.

  1. Where is Apex used? Triggers → Automate logic when records are inserted/updated/deleted.

Classes → Write reusable code and business logic.

Batch Apex → Process large amounts of data asynchronously.

Schedulable Apex → Run jobs at specific times.

Web Services / API → Expose or consume APIs.

  1. Your First Apex Code Let’s write a very basic example:

public class HelloWorld { public static void sayHello() { System.debug(‘Hello, Salesforce Developer!’); } }

public class HelloWorld → Defines a class.

public static void sayHello() → Method inside the class.

System.debug() → Prints output to debug logs (like console.log in JavaScript or print in Python).

👉 Run this in Developer Console → Execute Anonymous:

HelloWorld.sayHello(); You’ll see “Hello, Salesforce Developer!” in the logs.

==============

Trailhead Trail:

Trailhead Modules:

Trailhead Trailmix:


https://theswapnilzambare.github.io/Apex/