ποΈ 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.
| Type | The "Admin" Translation | Example Apex Code |
|---|---|---|
| String | Text / Picklist Value | String channel = 'Absenthome'; |
| Integer | Number (Whole numbers only) | Integer servers = 3; |
| Decimal | Currency / Percent / Latitude | Decimal cost = 99.99; |
| Boolean | Checkbox (True or False) | Boolean isOnline = true; |
| Id | 15 or 18-digit Record ID | Id 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.
| Command | Action |
|---|---|
sf org login web -d | Authenticate: Connect your browser to your dev org. |
sf project generate -n Lab | Initialize: Create your local project folder. |
sf project deploy start | Push: Send your local code up to Salesforce. |
sf org open | Launch: 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.
Generated by Absenthome β Lessons in Logic and Layers.