SF Development
SF Development
SF Development
DEVELOPMENT
-Shhaillaja Ghugarre
Introduction to Apex
-Components of Apex
-How does Apex works?
Object-Oriented
Programming Language
(OOPS)
Encapsulation:
Encapsulation is variables and methods together into a single unit and preventing them from being accessed by other classes.
Polymorphism:
Polymorphism refers to the ability of a variable, object, or
function to take on multiple forms. We use method overloading
and method overriding to achieve polymorphism.
Polymorphism:
1 Compile-Time Polymorphism
Run-Time Polymorphism 2
Abstraction
3 String 4 Decimal
It is a sequence of characters, either as
It provides the greatest number of
a literal constant or as some kind of
significant digits for a number
variable.
7 Picklist 8 Long
Long data types are whole numbers,
Provides a predefined list of values both positive and negative, that have
many place values.
from which users can select.
Currency
Email Phone
Handles numerical values with
Stores email addresses and Stores phone numbers with
currency symbols, precision,
includes validation and country codes, validation, and
and conversion rates.
formatting options. formatting options.
URL Address
Class Methods
Defination
Constructor
Constructor is a special member of a class used to initialize the
data members of class
Apex Methods
Apex methods provide a bridge between the front-end
Visualforce Pages and the back-end Apex code, allowing
seamless communication between them.
Benefits
Method Signature
Pass primitive data types or custom object Pass lists, sets, or maps to handle multiple
instances as parameters. values or complex data structures.
About Arrays
An array is a data structure that stores a fixed-size sequential collection of elements of the same type.
A collection is a container that can hold multiple values of different or same types.
Types of collections
2. Set A set is another collection type. Unlike List set is unordered as well as doesn’t allow duplicates.
e.g Set<Id>conid =new Eet<Id>();
2 Update 🔄
3 Delete
4 Upsert
2. Execute method
3. Finish method
Start method:
This method will be called at the starting of the Batch Job and collects the data on which
the Batch job will be operating.
Use the Database.QueryLocator object when you are using a simple query to generate the scope
of objects used in the batch job.
Execute method
where, list<sObject> is returned by the Database.QueryLocator method.
This method gets called after the Start method and does all the processing
required for Batch Job.
Finish method
This method gets called at the end and you can do some finishing activities
like sending an email with information about the batch job records processed
and status.
After finish method executes, the batch job status is updated, and any
associated asynchronous actions, like email notifications, can be
triggered.
Triggers in Salesforce
Triggers are powerful mechanisms that enable developers to
automate business processes, enforce custom logic, and respond to
data changes.
The new version of the records being The old version of the records prior to the
inserted, updated, or deleted in the trigger. trigger operation.
Trigger.newMap Trigger.oldMap
A map of record IDs to the new version of A map of record IDs to the old version of
the records. the records.
Trigger events
Execute before the record is Execute after the record is Execute on multiple records
saved to the database. saved to the database. simultaneously.
Test Classes
Test classes are essential in Salesforce to verify the functionality and integrity
of Apex classes, triggers, and batch processes.
Apex class test classes validate the behavior of your custom Apex classes, ensuring their
correctness in various scenarios.
Apex Trigger Test Classes
Testing Apex triggers is an important aspect of ensuring the quality and reliability of your
Salesforce application.
Batch Apex Test Classes
Test classes for batch apex help optimize processing and ensure high-performance data retrieval, analysis, and updates.
Apex batch jobs are a powerful tool in Salesforce that allow you to process large amounts of data in an efficient and scalable way.
Apex Component
An Apex component in Salesforce is a reusable and customizable building block
that allows developers to create powerful and dynamic web pages.
Lightning Components are reusable building blocks for developing dynamic and
interactive user interfaces. Lightning component is a user interface (UI)
framework that is used to create applications for desktop and mobile
technologies.