Skip to main content

Layer 0: Foudation Cheat Sheet


1. The Building Materials (Data Types)

In Apex, "Types" are your raw materials. You must define the material before you can build the layer.

TypeThe "Admin" TranslationExample Apex Code
StringText / Picklist ValueString channel = 'Absenthome';
IntegerNumber (Whole numbers only)Integer servers = 3;
DecimalCurrency / Percent / LatitudeDecimal cost = 99.99;
BooleanCheckbox (True or False)Boolean isOnline = true;
Id15 or 18-digit Record IDId myRecordId = '001000000000000';

2. The Containers (Collections)

We don't just let materials roll around; we put them in containers.

The List (The Assembly Line)

Use a List to hold multiple items in a specific order.

// Creating a list of strings
List<String> tools = new List<String>{'VS Code', 'CLI', 'Git'};

// Adding a new item
tools.add('GitHub');

// Getting the first item (Index 0)
String primaryTool = tools[0];

The sObject (The Apartment)

A container that holds all the fields for a specific Salesforce record.

Account myAppt = new Account(
Name = 'Absenthome HQ',
Description = 'Architecting the Automated Life'
);


3. The Logic (Control Flow)

Logic is the "wiring" that makes the building functional.

The Decision (If/Else)

Boolean doorLocked = true;

if (doorLocked) {
System.debug('Access Denied: Door is locked.');
} else {
System.debug('Access Granted: Welcome to the Lab.');
}

The Engine (For Loop)

Use this to repeat an action without writing the code multiple times.

// Constructing 5 floors automatically
for (Integer i = 1; i <= 5; i++) {
System.debug('Constructing floor number ' + i);
}


4. The Studio Commands (CLI Basics)

The essential commands for your terminal in the Absenthome Studio.

CommandAction
sf org login web -dAuthenticate: Connect your browser to your dev org.
sf project generate -n LabInitialize: Create your local project folder.
sf project deploy startPush: Send your local code up to Salesforce.
sf org openLaunch: Open your org directly from the terminal.

The "Absent" Pro-Tip

Always remember to end your lines with a semicolon ;. In the world of architecture, a missing semicolon is like a missing bolt in a skyscraper—the whole thing comes down.