Classes, Interfaces, and Methods – Data Manipulation Language (DML) – Salesforce Certified Platform Developer I Study Guide

5.2  Classes, Interfaces, and Methods A class is a fundamental component that defines an object’s functionality and characteristics. The basic structure of an Apex class consists of class variables also known as properties, and methods defined within the class. It serves as a template or blueprint from which objects are created and defines the behavior […]

Merge – DML Statements and Operations – Data Manipulation Language (DML) – Salesforce Certified Platform Developer I Study Guide

Merge: Is only available for certain standard objects in Salesforce, such as Account, Contact, Lead, and Case, and you can merge up to three records at a time. Account masterAccount = new Account(Name = ‘MyName’); insert masterAccount; Account duplicateAccount = new Account(Name = ‘MyName’); insert duplicateAccount; Database.merge(masterAccount, duplicateAccount); masterAccount = [SELECT Id, Name, (SELECT Id […]

Update – DML Statements and Operations – Data Manipulation Language (DML) – Salesforce Certified Platform Developer I Study Guide

Update: Used to modify existing records in the database. // Example List of Strings List<String> fruitNames = new List<String>{‘Apple’, ‘Banana’, ‘Orange’, ‘Grapes’}; // Create a list to store Account records List<Account> fruitAccountsList = [SELECT Id, Name FROM Account WHERE Name IN :fruitNames]; } if (!fruitAccountsList.isEmpty()) { update fruitAccountsList; // Iterate over the updated records to […]

DML Statements and Operations – Data Manipulation Language (DML) – Salesforce Certified Platform Developer I Study Guide

5.1  DML Statements and Operations DML refers to the set of statements and operations that you can use to interact with records in the Salesforce database. DML operations are used to create, retrieve, update, and delete records in various Salesforce objects, such as custom and standard objects like accounts, contacts, opportunities, and more. Salesforce provides […]

do-while Loop – Operators and Control Statements – Apex Programming – Salesforce Certified Platform Developer I Study Guide

do-while Loop: The do-while procedural loop is similar to the while loop, but it executes the code block at least once, regardless of whether the condition is true or false. It’s similar to the while loop, but with a key difference: the do-while loop always executes its block of code at least once before checking […]

for Loop – Operators and Control Statements – Apex Programming – Salesforce Certified Platform Developer I Study Guide

for Loop: The for loop is used to iterate over a range of values for a specified number of times. It is a procedural loop used to execute a block of code repeatedly for a predetermined number of iterations. for (Integer i = 0; i < 10; i++) { System.debug(‘The value of i is: ‘ […]

Division assignment – Operators and Control Statements – Apex Programming – Salesforce Certified Platform Developer I Study Guide

Division assignment (/=): Divides the current value of a variable by a value and assigns the result to the same variable. Decimal dividend = 20.0; Decimal divisor = 4.0; dividend /= divisor; // Equivalent to: dividend = dividend /divisor; System.debug(‘Result: ‘ + dividend); // Output: Result: 5.0 Control statements in Apex are used to control […]

Operators and Control Statements – Apex Programming – Salesforce Certified Platform Developer I Study Guide

4.5  Operators and Control Statements Salesforce Apex provides a variety of operators that you can use to perform different operations on variables or values. These operators include arithmetic operators, comparison operators, logical operators, assignment operators, and more. Let’s go through each type of operator: Arithmetic Operators Addition (+): Adds two values together. Integer a = […]

Maps – Collections – Apex Programming – Salesforce Certified Platform Developer I Study Guide

Maps: A map is a collection of key-value pairs, where each key is unique and maps to a corresponding value. Maps are often used to associate related data. Maps are useful when you want to associate related pieces of information and quickly retrieve the value associated with a specific key. The key and value in […]

Collections – Apex Programming – Salesforce Certified Platform Developer I Study Guide

4.4 Collections In Apex, collections are data structures used to store and manage multiple values of the same or different data types. Collections allow you to work with groups of related data in a more organized and efficient way compared to using individual variables. There are three main types of collections in Apex: Lists, Sets, […]