0% found this document useful (0 votes)
1 views

1st level Salesforce Development Prepartion

The document provides an overview of Apex classes, triggers, batch processing, Visualforce, and Lightning components in Salesforce development. It covers key concepts such as constructors, DML operations, pagination, integration types, deployment methods, and the importance of test classes with a minimum code coverage requirement. Additionally, it highlights the differences between various components and frameworks like Aura and LWC, emphasizing their structure and advantages.

Uploaded by

sabarish11star
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

1st level Salesforce Development Prepartion

The document provides an overview of Apex classes, triggers, batch processing, Visualforce, and Lightning components in Salesforce development. It covers key concepts such as constructors, DML operations, pagination, integration types, deployment methods, and the importance of test classes with a minimum code coverage requirement. Additionally, it highlights the differences between various components and frameworks like Aura and LWC, emphasizing their structure and advantages.

Uploaded by

sabarish11star
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

######## 1st level Development Preparation ########

Apex Class -
public class BankAccount {

// Variables
Decimal balance = 5000;

// Default Constructor
public BankAccount() {
// Logic
}

public BankAccount(Integer amount) {


// Logic
}

// Methods
public Decimal deposit(Integer amount) {
balance += amount;
return balance;
}

public Decimal deposit(Decimal amount) {


balance += amount;
return balance;
}

* Constructor executs only one time when the object is created. If you want to call
the logic again and again use method.

* Object -
ClassName objectName = new ConstructorName();
BankAccount bankAcc = new BankAccount();
BankAccount bankAcc2 = new BankAccount(500.50);

* How to call apex class, different ways ?


1. Developer Console > Anonymous Block --> call the class by creating object
2. Class can be called from test class when we run it
3. Visualforce / Aura / LWC
4. By exposing the class as API
----
* Apex Trigger -
* Trigger will be created on a specific object. On that object if the dml
operation is performed then trigger fires automatically.
* Supported DML operations -
1. insert
2. update
3. delete
4. undelete
* Trigger events -
1. before insert
2. before update
3. before delete
4. after insert
5. after update
6. after delete
7. after undelete
* Difference b/w trigger.old and trigger.new -
trigger.old --> When the records are updated or deleted at run time when
the trigger is executed, it holds the existing data which is present in the
database.
trigger.new --> When the records are inserted or updated or undeleted at
run time when the trigger is executed, it holds the new information

* Difference b/w Apex Class or Apex Trigger ?


* Apex Class should be called by creating the object or if the variable/method
is static we can call with class name
* Apex Trigger fires automatically when we perform the DML operation

* What is Batch Apex ?


* It is asynchronous.
* It supports 50 Million records.
* To peform the business logic on huge number of records we use batch apex.
* When we say the class is batch apex?
* if the class is inherited the Database.Batchable interface
public class MyBatch implements Database.Batachable<Sobject> {

// It executs only one time, purpose is to return the records to execute


method to apply the logic
public Database.QueryLocator start(Database.BatachableContext bc) {
return Database.getQueryLocator('SELECT Id, Name FROM Account');
}

// It executes multiple times by dividing records into batches (Default


batch size 200) or might not execute if the start method returns null
public void execute(Database.BatachableContext bc,List<Sobject> sobject) {
// Logic
}

// It executs only one time, the purpose is for the post commit logic
public void finish(Database.BatachableContext bc) {
// Sending email / tracking errors
}

}
* Types of Visualforce controllers -
1. Standard Controller -
<apex:page standardController="ObjectApiName"></apex:apex>
2. Custom Controller -
<apex:page controller="ApexClassName"></apex:apex>
* How to achieve the pagination in visualforce -
1. ApexPages.StandardSetController
2. Using Limit and Offset in the SOQL query
* What is wrapper class ?
To wrap multiple data types information together within a class and use the
class to show as a table or record on the UI
Example:
1. To hold check box value and record together and dispaly as a table
2. To hold different records info in the class and show as a table
* Types of Ajax Functions ?
1. actionStatus
2. actionSupport
3. actionFunciton
4. actionPoller
5. actionRegion
* What is Visualforce Component?
* To make the visualforce logic reusable we use visualforce component.
---
* Why to create test class and what is the min code coverage required?
* To do unit testing how the main class works and min over all code coverage
for the organization should be >= 75% (which is required while deploying to the
production)
---
* Types of integration -
1. SOAP API : WSDL file is used to peform integeration. XML is used for the
data exchange.
2. REST API : Endpoint url of the api is used for the integration. JSON/XML is
used for the data exchange
---
* Different ways of deployment?
1. Change Sets
2. VS Code
3. Force.com Migration Tool (Ant Tool)
---
* What Aura component ?
* It is a framework to develop the UI. When we create Aura component it creates
bundle with the following files -
Sample.cmp --> UI
SampleController.js --> client side logic (Only specific to current
component)
SampleHelper.js --> client side logic (It can be reusable)
Sample.css --> (To apply styles)
Sample.design --> (To provide configurable options in the app builder)
Sample.auradoc --> (To show the component in the component library
documentation)
SampleRenderer.js --> (To override standard events logic)
Sample.svg --> (To change the icon of the component which display in app
builder)
* It is faster when compare to visualforce and it is app centric
---
* What is LWC ?
* It is introduced in 2019, it is faster when compared to aura by taking the
advanage of the modren webstack.
(Webstack: the latest features (HTML, JavaScirpt, CSS) supporeted by the
browsers)
* When you create LWC you see the following files in bundle -
1. html --> template (UI logic)
2. js --> client side logic and to call apex logic
3. xml --> used to expose the lwc (to show in app builder or use as tab or
quick action)
---

You might also like