Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 128

Salesforce:

-------------
company
1999- marc benioff ---USA---CEO

cloud Competing ...

Salesforce CRM-

SDLC

1)Requirement
2)Design
3)Development
4)Testing
5)Deployment

BA---
Enterprice App--

Admin + Developement + Clouds

java , python , .net .......----Coding


Salesforce ----60 % Coding and 40 % GUI

Apex---It it a one type of Backend Developement lang. 90% same as java lang .

In I.t Industry there are 2 tyepes of companies.

1) Product base company / Vendor Company :s/w product like

O.S, Programming Languages,databases,Technologies,Packages, Applications...etc

Google--Gmail
Microsoft--windows, ms-office
Salesforce --CRM,Salesforce
IBM---db2
SAP--ABAP
Oracle--Oracle database

2)Developement Company /Service Base Company :s/w Applications.

TCS
Tech Mahindra
Wipro
Infosys
Cisco
Capgemini...etc

Cloud Computing:
----------------
it is a technology/Concept , Whatever I.T services we require evrything will
provide by Vendor company
as user we just need only internate connection and access those services.

KFC---system and s/w App ----business turnover in crores


Bakery---Don't System or s/w App ----Thousands or in lakh

Time , Cost,Security, scalability -----Advantages og s/w

Difficulties------s/w App

upgradation
maintanance
installation....everthing will be taking care of clients and Development
companies---set up Cost

Everyday i want to check my mails and i want to take print outs.

Laptop--50k
printer--20k
Stationary--500rs
Internet connection---1000rs/month
70 to 75 k ---per month

instead of that go to Internet cafe ---

30min ---10rs
stationary --10 rs

monthly only 6k
--------------------------------------------------------------------------
Vendor company provides 3 Types of Services :

1) IaaS: (Infrastucture as a Service)

Here vendor company provides "Hardware" as a Service to clients and


Developements companies is Called as Iaas.

Amazon is one 1 company .....

example: Google Drive ---Storage Facility---15GB/user---Video,pictures,photos etc

2) PaaS:(Platform as a service)
Here Vendor companies will provides O.S, Programming Laguages,D/B,
As a service to clients and Developements companies is called PaaS,

Salesforce is one 1 company ....

example:Salesforce----force.com/lightning
Developer develope Apps As per client requirements
RAD--Rapid App Developement (quick/fast App Developement)

Java , .Net ----5 to 6 years

salesforece ----12 to 14 months Dev.

3) SaaS:(Software/App As aService)

Here vendor company provides directly Applications


as a service to clients and Developements companies.
example: Google Gmail Application

Google is one 1 company ....


------------------------------------------------------------
Why salesforce is one 1 CRM in the World ??
1)Salesforce internally supports 10 diff Tech.
2)Enterprice App---BA + CRM + integrated Application
3)no code ,low code , pro code concept

Java , .net ----

UI Jdbc/Hibernate Oracle / MySql DB


JSP

500 line codes ....


In Salesforce 28 to 30 lines Codes
---------------------------------------------------------------------------

Salesforce company has many multiple clouds:


--------------------------------------------
1)Mkt cloud--it is an Application---Marketing
2)Sales Cloud---It is an Application ----Sales
3)Service cloud---It is an application ----Service/Support

CRM=Mkt(Pre sales)+Sales+Service(Post sales)


Customer relationship management

Goals of CRM:
maintained the Existing Customer and Grab the new customer into the Business.

Quality product
Quality Service

1983---kapil dev ---TV B& W


Mr.sahdev---Videocon---DD
onida
BPL
Videocon....

Sony , LG , Samsung etc.....Now that are leading companies


mr.vikas ---SMS...

4)Data.com-- it is a place where we can get the complete information about all the
clients in the world.
5)database.com---it is a place where we can get the information about salesfoece
company.
6)commerce cloud---It is related to B2B and B2C
B2B---Business to business
B2C---Business to Customer/Cunsumer

KFC---Chiken /Drinks ....coca cola , pepsi, thumpsup

7)Health cloud----It Contains the Relationaship b/w Doctors and Patient.using that
patient can
take Appoinment with doctor and he can get some info about his health issue.
8)Einstein cloud---IoT + AI
Internet of things --- machine to machine communication
examples: AC---Mobile
TV----Mobile
Artificial Intelligence ---- machine can usderstand human lang.
Exaples: Alexa, Siri

Salesforce Partners:
---------------------

1)developer.force.com:
----------------------

for every Application we have 2 faces

1) SaaS side--where n end users can sit and USE the Application
2) Paas side-- where developers can sit and DEVELOP the Applications as per
businees need.

facebook.com----SaaS
developer.facebook.com---PaaS

linked.com----SaaS
developer.linked.com----PaaS

2)dreamforce.com: Salesforce Company will arrange this on every year


------------------
Every yearly Salesforce conducted one EVENT this event name is Called
Dreamforce.com
In this Event across the globe from all the companies CEO, CTO,Architects,
Developers,
MVP(Most VAlueable Persons)
2021---Sep 20 to 22 ---3 days ---USA----Salesforce Company

3)AppExchange.com:-
-------------------
It is a place wherev Developers can SELL the Applications and where as
clients will BUY the Applications

Example : AppStore/ Play Store ---App----frelly down/ Pay

Trading -----Selling /buying place of salesforce

Project and Product


-------------------------

Pune ----Metro Train(Project)-----L&T Company

Thakrey----CM
Shinde-----CM

I want a dirrect line from hinjwadi to Airport

Product----IPhone 14

Force.com------Both can Applicable here

Enterprise Application:- Combination of 3 Types of App


--------------------------
1)BA---Business Application ----handles the business
Activities
2) CRM--Customer Relationship Management---customer relation
maintained
3) Integration Application-----
Exchange the data between multiple organization in a hetrogeniuos environment.

BookMyShow-------bank payment gateway ---HDFC---SMS


SMS
PHP Finacle

except only 2 types of App:


Gamming App And scientific App are not possible to develop on Force.com
platform

--> Why salesforce is one 1 CRM in the World ??

1)Salesforce internally supports 10 diff Tech.

a)O.S----
b)Programming Lang--Apex---OOpl
c)Database--Oracle
d)ETL--extraction ,transformation and loding---Informatica--Admin part
e)BI---reports and dashboards ---Admin part
f)Mobile programming---
g)IoT---machine to machine communication
h)AI---machine can uderstoode the human lang
i)Big Data---hadoop
j)Cloud Computing ----

RAD ---Rapid App Developement


2)Enterprice App---BA + CRM + integrated Application
oracle
M/s
SAP
Seibel
people ......etc CRM s in market Applications on premies CRMs
Salesforce CRM ---it is not an Application but it is Domain.
where domin means it is not confined to any particuler things it is open for
all.

ABC.company (Client)----------------------------TCS(Development Company)

TCS decided to develop the Enterprice App by using JAVA Tech.

TCS---hired 2 Java developers for developing the business Application


Rohit & Rupali

TCS--hired 2 CRM developers


Shital & shreyash

TCS ---hired 2 integration application Engg


Vivek & Vikas ---Web Services

4 / 5 years .......

Balaji-------Salesforce Developer ------BA + CRM + Integration App


Salesforce Act as a All rounder.
3)Salesforce Follows---> no code ,low code , pro code concept

Versons Of Salesforce :
-----------------------------
Every year salesforce releases 3 types of versions based on seasons.
1) Winter version
2) Summer Version
3) Spring Version

java ---1.0,2.0,3.0...................9.0----numeric formate


Oracle ----1.0,2.0...................7.0, 8i,9i,10g,12c.....
i-internet
g-grid
c-cloud

Editions Of Salesforce:
--------------------------
Plan---editions

8805589715----prepaid ---Airtel---2010

Airtel Executive---explain about the plans which is given by AIRTEL

149/m 249/m 349/m-----


i--i free
1 gb data per day
unlimitad calling
There are 5 Types Editions in salesforce :
--------------------------------------------
1)Essential
2)Enterprise
3)professional
4)Unlimited ...............Paid Editions
5)Developer edition----------Free edition for all

Governor limits and Best Practices will vary from one edition to another edition

Batch Apex

-----------------------------------------------
1) what is Salesforce ?
2) what is Cloud Computing ?
3) Why Selesforce is one 1 CRM in the world ?
4) Partners of salesforce
5) what are the Multiple Clouds Of salesforce ?
6) Types of Services provided by Vendor Companym ( PasS,SaaS,IaaS) ?
7) Versions OF Salesforce
8) Editions of Salesforce

--------------------------------------------------------
There are 2 Types of Environments in Salesforce :

1) Sandbox Environment:-It is Completely Developement Environment, where


developers can sit
and develop the Applications as per the business need or client requirement.
It is purely PaaS environment
There are 3 Types of sandboxes:
a)Configuration Sandbox:It is a place where Developers can develop the
Application completely
based on GUI-----No need to write any Programming/ Coding.
40% application we can develop Through GUI(Graphic User Interface) only...

b)Developers Sandbox:It is a place where developers can sit and develop the
application completly
based on CODING----Here need to write completly pragramming using a Programming
Lang Called
"APEX"
60% application we can develop through Programming /Coding.

SDLC(Software Developement life Cycle):


-----------------------------------------
1)Requirement
2)Design
3)Developement
4)Testing
5)Deployment

Testing :- It is a process of checking wheather application really meeting the


customer's
or clients requirements or not .....

c)full Copy Sandbox:It contains the replica (Duplicate copy) of the original
application
It is used for Testing purpose.

Deployment:-Move application from Sandbox Environment to Production


Environment.

2)Production Environment:
-------------------------
It is purly End User /Clients environment , where client and client employees
are using this application .
It is purely SaaS/AaaS evnvironment.
is client & client's employee are they how to use ....?
to guide them or monitor them , there another person who sets at client's place
that person , we can call him as Super User/ System Administrative.

Roles & Responsibilities of System Administrative:


---------------------------------------------------
1) Create the user accounts.
2) Create the user roles
3) create the user Profiles
4) Data Management operation ----Import/ Export
Import---Moving the Data from External System to salesforce
Export---Moving the Data from salesforce to External System
5)Data Automations & Approvals ---Using some tools like
Workflow, process Builder,flow builder and Approval process
6)Data Analysis--Business Intelligence ----Reports And Dashboard

7) Data Security---
Org level security
App Level security
Tab Level security
Object level Security
Field Level security
Record Level security
OWD--Org wide defaults
Role Hierarchies
Sharing Rules
Manual Sharing

MVC Architecture :
-------------------

Model View Controller


It is a 3 tier / layer Architecture

View (UI) Controller


Model

Presentation Business Logic Layer


Database Layer
Layer

End User --> View <--> Controller <--> Model


Vikas Reg Form Business logic Database stored records
open

Every Technology follows MVC Architecture

w.r.t.Salesforce

-----------------------------------------------------------------------------------
-------------------------------
Configuration Part

Model Layer:
------
2 Parts
1) Schema : Apps, Tabs, sObjects, Field , Relationships, Validation rules, Field
Dependancies,
Page Layouts , record types , cross object formula fields , global picklist,
track field history

2) Instance : Data & Records

Controller Layer: Developement


-------------
Oops, Exception Handling , Assertion , Annotations , Database
Concepts(SOQL and SOSL),
DML commanads (insert, update , delete , undelete, upset)

Controllers:- Standard Controller , Custome Controller,Standard List


Controller,
-----------
Custome list Controllers, standard set controller, extention
Controller
View Layer:--UI ---User Interface
------------
visualforce ---markup langauge.... like HTML is used too
develop UI (User interface )

Interfaces , Batch Apex , Sheduled Apex, Triggers

Configuration Part:-

1) Basic Vocabulary in Salesforce :-


-----------------------------------
1) App: Collection of services / groups of services can be called as App.

BookMyShow--- list of cities --service 1


list of theaters---service 2
list of Movies ----service 3
list of Timings ----service 4
seats availability---service 5
tickets Avaibales---service 6
foods availability---service 7

w.r.t Salesforce
App: App can be define as group of tabs which provides some fuctinality.

In salesforce Apps are devided into 2 part

1) Standard App:-Any app which is given by salesforce .


Ex:- Sales, MKt, Service .........

2) Custom App:-Any app which is created /developed by Developer as per the


business need or client requirement.

Ex:- BikkadIT, ABC.company ,SBI Application .....

2) Tab: It connects from one page to another page.

w.r.t.Salesforce
Using Tab we can Access the sObject.

in salesforce we have 2 types of Tab


1) Standard Tab: It is Given by Salesforce.
any tab which is given by Salesforce is known as Standard Tab.

Ex:-- Campaigns, Leads, Accounts, Contacts , Opportunities......


------------------------------------------------
Note :--Every Tab name is plural format.
------------------------------------------------

2) Custom tab:- It is created By Developer as per client requirement or business


need .

EX:-students , employees, trainers, courses, doctores.....

3) sObject: It means Salesforce Object.

salesforce object is nothing but database Table.


sObject-----It is place where we can store the information permanantly in the
form of rows and columns.

In salesforce sObject are divided into 2 parts


1) Standard sObject: Any sObject which is given by Salesforce is known as
Standard sObject.

Ex:- Campaign, Lead, Account, Contact , Opportunitie......


------------------------------------------------
Note :-Every sObject is Singular format.
-------------------------------------------------
2) Custome sObject:any sObject which is created by developer as per client /
Customer requirement.

Ex:- Student, employee, trainer,Course..........


-----------------------------------------------------------------------------------
-----------------------------------
Note:-We can distinguish standard sObject and custom sObject is every Custom
sObject ends with "__c"(Double underScroll C )
-----------------------------------------------------------------------------------
----------------------------------

4) Data :- It is a Value /Data which store against the field

Whatever we enterd into system is called Data.

numbers-----0 to 9-------------------- 10
alphabets---a to z or A to Z------ 52
Spl characters--- +,@,#,$,%,*------ 194
256----Data

Data can aslo be called as Row Facts , because data doesn't gives any meaning.

eid ename salary -----Data reprtesents/describes another data


----Meta Data
10155 Sanket Dherange 90000
26242
43273
43567

5)Field:- It represents Data/ Value

Note : Field is Vertical on every time.

6) Record:- Horizantal Collection of data can be called as Record.

In Salesforce We can Create the Account in 2(two) modes ....

1) Classic Environment----MVC
2)Lightning Environment----SPA (Single Phase Application)
Saas to PaaS-------Setup
PaaS to SaaS-------Click on any Tab.

1(App)----many (tabs)
1(Tab)----Many (App)

Many to Many ----Relation between app and Tab.

Custom App----while creating custom app here is used for Big custom app
developement
Consol App----It is used to create Small custom app

App: My 1st Application


Tab:Employees
sObject:- Employee
Fields:- eid ename salary deptno job

# Assignment for tomorrow

App: BikkadIT pvt ltd


Tab: Students
sObject: Student
Fields: sid sname qualification contactNo emailid DOB

App:Bank of India
Tab:Accounts
sObject: Account
field: Sr.no Name Contact Address Pincode AdharNo

Who will create all above ?


Developer

for whom he will create ?


Client
business person

App, tab, sObject, fields -------Developer

Developer ----------------------- Avinash Shinde

Prakalpa Travel business -----App name


----------------------
Tab sObject
Cabs ------------- Cab
Drivers ---------- Driver
Mechanics -------- Mechanic
GPS--------------- GPS

whichever is IMP / key pillars of your business , those things we treated as


sObject
of your business.

Identifying the fields in the sObject is the most challenging task for the
developers.

One field existed in one sObject then there might be a chance of existing the same
field in
another sObject.

XYZ.comapany ----100 employee 4 depts dept--No


relation
------------------------------------------------
-------------------------------
eid ename salary deptno deptno dname
location
1 10 90 mkt
pune
25 10 20 sales
AWB
26 20 30 HR
buldana
50 20 40 Finance
mumbai
51 30
75 30
76 40
100 40

Arti-----HR Manager

report -------- see the employee details who are working under deptno 90

no employee ----no report

Data inconsistancy ----- Data inaccurate

What is relationship:
------------------------ Data store physically in one sObject , if you want create
a link and access the information in another sObject.

Why relationship:----To avoid data inconsistancy

Types of relationship:
----------------------
1) Self
2) Lookup
3) Master Details
4) Many to Many
5) hierarchical
6) rollup Summary

Self Relationship: Deriving one field value depending on another field(s) within
the same sObject.

Student

sid sname m1 m2 m3 Total Marks Avg Marks


1001 Umesh 92 87 60 242

Lookup Relationship:-
----------------------
1) In this Relationship, we have 2 sObjects are involving out of which 1 is
parent
and the another one is child .
sobject1 sobject2
13 members family -------------------------- 2 parent
more no records -----child
less no of records -----parent

2) In this relationship, child sobject can get the complete and detailed
information about the parent sobject.

3) if we delete any records from the parent sobject then the corrosponding
records
in the child sobject not deleted, only linked field value becomes null.

I have institute like Bikkad IT ----courses


student
sid sname qulification m1 m2 m3 DOB email phone no

Master-Details Relationship:
------------------------------
1) In this Relationship, we have 2 sObjects are involving out of which 1 is
parent
and the another one is child .

sobject1 sobject2
13 members family -------------------------- 2 parent
more no records -----child
less no of records -----parent

2) In this relationship, child sobject can get the complete and detailed
information about the parent sobject.

3) if we delete any records from the parent sobject then the corrosponding
records
in the child sobject deleted.

4) linked record is mandatory in master details .

# Many to Many Relationship :


----------------------------
In this relationship , we have 3 sobjects are involving ,out
of which
2 are parents and 1 is child.

father mother
child -------junction object

Junction object -----if any sobject has 2 parents then that child sobject can be
called as junction object .

course Trainer ------parents------- Trainer name salary


contact no

M_D M_D
student ----child
male female ------ 5 childrens (orphans )(Recylebin)
x y
master details

3 child

1(c)---many (t)
1(t)---many (c)

many(c ) to many (t)

5) rollup summary:
-----------------
In this relationship,Parent sobject can get summarized information
about the child sobject.

we can rollup summary by using ,some predefine fuctions/methods.

sum()
max()
min().......workds on fields in the sobject
count().......works on record in the sobject

I have institute 3 courses


How many students joined in each course ?
salesforce
Java
ML

Note:- We can't create rollup summary on lookup relationship


it is posssible only on master details relationship.

-----------------------------------------------------------------------

Validation Rules:-
------------------
validation is a mechanisum which is used to stop/restrict
invalid data,which is
entered by the end user to implement businees rules.

There are 2 types of validations


1) Standard Validation :-it is given by salesforce already

a) size/width checking
b) data type checking / Invalid data
c) uniqueness checking
d) mandatory fields checking

2) Custom Validation:- These are the validations which is created by the


developer
as per businees need .

Example : I have an Institute Rule , whoever trying to join my institute


that student should
have more than 22 years old .
Age = today - dob

Examples for practice :

1) Employee
salary <25000

2) whoever trying to join my institute that student should


have more than 22 years age if course name is Salesforce.

# Field Dependency / Pick List Dependency:-


-------------------------------------------------
One field depending on another field .
----- ---------------------------------------------

States
cities

A.P
Vij
Viz
kadapa
Maharashtra
mumbai
nagpur
pune
Nashik

Page Layout :
-------------
HDFC ---customer ---Application Form
Rahul ----Manager ----Screen
Sambhaji ----Cashier----Screen

Customer field ----100 field

ATM ----screen

Page Layouts:
there are 2 types page layouts .
1) Standard Layout : Given by salesforce
2) Custom Layout : Created by developer

---------------------------------------------------------------------------
APP , Tab , sObject , fields , data , records ,
relationship
validation Rules
Field Dependancy
page layouts

Record Type --- Pick list

Used to hide the Values based on businees requiredment.

Amazon.com and Amazon.in


Globle picklist:-
------------------
world ----country---200+ 1 time and reused in other sobjects
student course trainer employee ----800

Cross object formula field:- FORMULA


-----------------------------

STUDENT COURSE
SID SNAME COURSE NAME COURSE NAME FEES DURATION

---> Along with standard field if we want add another field under parent sObject
then we used
cross object formula field

Track field history:- We Need to track the data in the field.

-----------------------------------------------------------------------------------

# 2) Developement :-
-----------------

Apex :
Programming Lang:
------------------
Langauge:- It is a medium through which we can communicate to each other .

3 Types og langauges:

1) HLL---Human
2) MLL---HLL+LLL
3) LLL---Computer -- 0,1 ---bits / Binary lang

Translator ---Human ---Convert---computer

Compiler ---Translate the complete program at a time from High level to Low
level
Interpreter--- translate the program line by line
Assembler --- translate the program from MLL to LLL

HLL-----3 Types

1) Programming Lang --C ,C++, JAVA , python, Apex etc


2) Scripting Lang ---asp, php ,jsp , javascript etc
3) Markup Lang --- html, Css , Visualforce,

Programming Lang ----> A lang has the capability to Develop

D/B------Oracle ---C++

System S/W--- Unix ----C


Technology--- .net ---C++

Packages ---msoffice --- VC++

Applications--- Java , Python , Apex , etc

Programming Lang ----5 Generation

1) Monolithic lang ---Basic


2) Structured lang ----Cobol
3) Popl(Procedure oriented programming lang)--- C , Pascal
4) obl(Object based lang)-----ADA
5) OOPl(Object oriented prog lang)---C++,Java, Apex

Comparision Between Natureb Lang And Programming lang :-

Natural Lang(English) Programming Lang (C)


-----------------------------
--------------------------------

Paragraph ----------------------------------------------- Program

Sentences ----------------------------------------------- Statements/


instructions

Words ---------------------------------------------------- Tokens

grammar ------------------------------------------------- Syntax

i will do work ---correct


do will work i ---wrong

Program : it is a collection of statements/ instructions to perform a well define


task.

Statement :It is a collection of Tokens to perform a small task

Token : it is a part of the statement which convey some meaning.

Syntax : It is a grammar /rule /format

In any Programming lang ,we have only


5 Statements and 5 token

Statements :- 5
1) Input statement
2) memory statement
3) Control statement
4) Arithmatic & logical Statements
5) Output statement

5 Tokens :-
1)keyword / Reserved Word:
It is a special type of word , which has some predefined functionality
and meaning.
every lang has its own keywords

c---32
c++---64
java----50

2)Variable: It is a name given to the memory location through which we can


indentify the value .
a= 10 ----memory ---RAM
3)String :Group of characters
4)Constant:The value of the constant can't change during the execution of the
program.
ex. PI ---22/7
5)Operator: It is a special symbol which performs some operation on operand .

APEX
--------
1) Data types in Apex:
------------------------
There are 2 type of Data types
1) Primitive Datatypes :--- 10
a) Integer---- -214748 t0 +214748----pincode --425107
b) Long ------ -2^63 to +2 ^63------Adhar , Pan , Bank ACC
Both are allows Interger Value +ve or -ve

c) Decimal
d) Double
both are used to Decimal values

e) Boolean---True or false
f) String ---Characters Values
g) Date ---Date Value
h) Time --- time Value
i) Datetime--- Both date and time
j) Void -----Fuctions

Example:-

2) Complex Datatypes: There are 3 types Complex data types available in Apex

1) ID --indentyfication---whenever we insert a new record into employeee


sobject ,
salesforce Automatically generates unique record id for every record in the
sobject .
This record id contains 15 digit alphanumeric value.

a005g000038RUXD
a005g000038RULP
2) sObject---Salesforce object ----Collections

3)Blob---Binary large object ---This data type allows us to enter any kind of
pictures,
clippings , sounds , images , audio, videos etc

Operators in APEX:-
---------------------

1) Arithmetic Operators :-
+,-,*,/
2) Relational Operators: >,<,<=,>=,==, !=

3)Assignment Operator: =

4) Logical Operators: && , !, ||,

5) Incremental Operators :- ++ ---> It is Incremented by only 1

a=2,b,c
b= 2 * (a++);---Post increment ---2+1=3
c= 2 * (++a);---Pre increment ---1+3=4
b= 4 c=8

6) Decremental Oprators: -- --> It is Decrement by only 1

a=2,b,c
b= 2 * (a--);---Post Decrement --2-1=1
c= 2 * (--a);---Pre Decrement --1-1=0
b= 4 c=0

7) Bitwise Operators: >> , <<

8) Arithmatic Assignment :-
+=
-=
/=
*=

9) Conditional Operators : ? And :

10) Special Operators :

. ---member access oprator


this ---name shadowing oprator
new -- this operator is used to allocate the memory dynamically for the
object.

--------------------------------------------------------------------------------

Input and output Statments in APEX:

There is no input and output statments in APEX


input given by end user on UI
output display infront of the end user on UI

System.debug (); ----this is not a output statment , but this statement will
write the output in log file.

log file : it contains the history of your program .

Syntax:
System.debug('Massage');
eg: System.debug('Bikkad IT Pvt Ltd');

Syntax:
System.debug('massage'+ variablename);
eg: System.debug('The result is '+ result);

Syntax:
System.debug(variablename);
eg: System.debug(result);

Variable Declaration in APEX:


---------------------------------
Syntax:
datatype variablename;

eg: Integer x;

Syntax:

datatype variablename =value ;

eg: Integer x=10;

Comments in APEX:
--------------------

1) Single line comment: //

2) Multiline comment : /* */

Examples : -

1) Print BIkkad IT Pvt Ltd .


System.debug('BIKKAD IT PVT LTD');

2) Input 3 numbers and find out its sum ?

Integer num1,num2,num3, result;


num1=100;
num2=200;
num3=300;
result = num1+num2+num3;
System.debug('The Sum is' +result);

3) Perform Arithmatic Operation :


Integer num1,num2;
num1=100;
num2=200;
System.debug('The Sum is' +(num1+num2));
System.debug('The Subtraction is'+ (num1-num2));
System.debug('The Multiplication is'+(num1*num2));
System.debug('The Division is'+(num1/num2));
System.debug('The Remainder is'+math.mod(num1,num2));

# Control Statements in APEX:-


-----------------------------

1) Conditional Control Stetements :- Simple if , if-else , if-else-if , Nested


if ,series of ifs....

2) Iterative Statements :- For Loop, for each loop , while loop , do-while loop
,

3) Jump Statements :- continue, goto, return , switch , break, exit ....

-----------------------------------------------------------------------------------
-

Simple-if
-------------
Integer age=15;
if (age>=18)
System.debug('You are eligible for Voting ');

if -else :
---------------

Integer age=22;
if (age>=18)
System.debug('You are eligible for Voting ');
else
System.debug('you are Not eligible for voting');

if-else -if :
-------------
Integer a,b,c;
a=10;
b=20;
c=30;
if(a>b && a>c)
System.debug('A IS BIG');
else
if(b>c)
System.debug('b is Big ');
else
System.debug('c is big');

Nested If :
-----------
Integer a,b,c ;
a=2000;
b=2000;
if (a!=b){
if (a>b)
system.debug('A is Big');
else
system.debug(' B is Big');
}
else
system.debug('Both Are Equal');

Series Of if...
------------------

Integer a,b,c,d,max ;
a=1000;
b=2000;
c=5000;
d=90;
max=a;
if(b>max)
max=b;
if(c>max)
max=c;
if(d>max)
max=d;
System.debug('The max Value is '+ max);
-----------------------------------------------------------------------------------
-------

Function / Method :
--------------------

5 Generations
-------------------

Monolithic---- Basic
Structured---cobol
POPL----pascal , c ------modularity concept ----division code
OBL -----Ada
OOPL -----C++, Java , Apex

School Application -------------cobol

----
----
----
----------
----------
----------
------
------
------
------
-----------
-----------
-----------
-----
-----
-----
-----------
-----------
----------

C ---

main()
----
----
----
----
Addition (); jump
------
----
----
-----
Addithin();

-----
-----
------
-------
}
Addition (){

Adv:
decrease the redundency of instructions
time saving
less memory occupation
performance improve
within time

Subprogram --- procedure , fuction .

Fuction :it is a subprogram which perform some specific task / opration.

or
it is a self contained block which perform some task

Adv:
Reusability
time saving
less memory occupation
performance improve
within time

Types of Function :
-------------------
1) Predefined /built in fuction
2) User defined Funtions

Property of the fuction :


--------------------------
Fuction always returns only 1 value .

Parts Of the fuction : 2 Types -------> Very IMP


-----------------------------
1) Calling Point :- 3 Types
a) Function name/ method name
b) list of args / parameters
c) ;

2) Defination point :---2 types


a)Function Header ---3 types
1) return type
2) fuctioin name
3) list of args / parameters
b) fuction Body :- {

4 Type -----receive and return value :-


----------------------------------------------
1) receives and returns

Integer num1, num2 ,result;


num1=10;
num2=20;
result= addition(num1,num2);//calling point
system.debug('The result is'+ result);

Integer addition (Integer x, Integer y){


Integer z;// Local Variable
z= x + y;
return z;
}

2) receives but doesn't return

Integer num1, num2 ;


num1=10;
num2=20;
addition(num1,num2);//calling point

void addition (Integer x, Integer y){


Integer a,b;// Local Variable
a= x + y;
b= x - y;
system.debug('The sum is '+ a);
system.debug('The Substraction is '+ b);
}

3) doesn't receives but return

Integer result ;
result =addition();// calling Point
system.debug('The result is '+ result);
Integer addition (){
Integer a=10,b=20,c;//local variable
c=a+b;
return c;
}

4) doesn't receives and doesn't returns

fun(); //Calling point

void fun(){

system.debug('BIKKAD IT PVT LTD');


}

-----------------------------------------------------------------------------------
-------

OOPs :- Object Oriented programming , no meaning of 's'


-----

This is concept /collection of principles/pillers


-------------------------------------------------------

1) Encapsulation
2) Abstraction
3) polymorphisum
4) Inheritance

who developed these principles ?


Mr. Grady Booch

1)Encapsulation :-

Variable: It is a name given to the memory location .

a=10;
a=100;
a=1000;

The limitation of the variable is , it can store only 1 value .

Arrays: It is a collation of values which are all belongs to same data types .

project ----collage ------1000 students

1000 variables

Integer srno [1000] ;

Integer ---- data type


srno ---- variable
[]--- arrays
1000- --number of elements / values in the array
Entity ----Student
srno sname dob fees aggregate marks
101 Raj 15/07/1994 40000 87.9
int String date int decimal

-----------------------------------------------------------------------------------

3 Types of Data Types

1) System/predefined /Primitive ----int, long, double, string ,decimal.....etc


2) Derived Data types ----arrays / Collections
3) User defined data types----

'C' ----keywords ---

Struct
union
typedef
enum

Struct student {
Integer srno , fees;
String sname ;
date dob;
decimal am ;-----data members
}

main (){

Struct student v ;-- 'V ' is a variable which is belong to


struct student user defined data type .

v.srno ;
v.sname ;
v.dob ;

OOPL:- C++, VC++, java , Apex etc

Data :-
if we want to perform the operation on data , what we need to do ?

we need to write Fuctions/ Method

divided data (Structure )and functions (Main method )-----

God --- 2 hands


Each hands has there own functionality
write , type , eat , handle , wash .....etc
hand has there properties
color ---white / black
lenght
weight

Encapsulation:-
Wrapping of data and related fuctionaliies are together as a single unit.

We can implements encapsulation using 2 keywords:


-------------------------------------------------------------

1 ) Class --- 4 define


a) Combining data and related fuctionaliies are binding together.
b) Combination of state and behaviour
c) It is a user define data type
d) It is a blue print of real word entity

2) Interface ----

Syntax of Class :

class <classname>{
data members

members methods

eg: class student {

Integer srno, m1,m2,m3,tm;


String sname ;
decimal am ;

totalmarks (){

}
Avgmarks (){

Abstraction :-
-------------
Showing the set of services and hiding the internal data .

4 Keywords / Modifiers :-

1) Private: The member(data members + member methods)of this abstraction could


be visible
and accessible to only within the encapsulation (Class)
2) Public : The members of this abstraction is visible and accessible in the
entire Org
3) globle : the member of the abstraction could be visible and accessible in
the entore SFDC
4) Protected:the member of the abstraction could visible and accessble in
another encapsulation(Class)

Syntax Of Abstraction:

abstraction <data member>


abstraction <member method >
eg:
1) private Integer srno;
2) public void totalmarks(){

Note : At the encapsulation(Class) level,Data members should be always Private


abstraction and wherev as
member methods are always public abstracation.
By Default all members of the class are in Private abstraction .

Apex Classes are divided into 2 Types :-


--------------------------------------------------
1) Business Class :-- Defination Point
This class contain the actual businees logic

2) Test Class:-- Calling Point


It contails the object defination, throught which we can execute the
business class .

Businnes Class always executed via Testclass .

Annotation: It convyes some meaning to the server.

@isTest : This annotation conveys to the server saying that it is not businees

class but it is test class .

-----------------------------------------------------------------------------------
---------

write an apex class input 2 numbers and display the values .


-----------------------------------------------------------------------------------
-
2 data members ---Integer
member method -----4 Types
a) create
b) input
c) Process
d) Output

2 member method---input , output

Example :-

Businees Class :-
public class FirstClass {
Integer num1,num2;

//Member Methods
//Input
public void myMethod(Integer x, integer y){

num1=x;
num2=y;
}
// output
Public void showMethod(){
system.debug('the first number is '+(num1*num2) );
system.debug('the second number is '+ num2 );
}

}
Test Class :-

@isTest
public class FirstClassTest {

public static testmethod void main(){

FirstClass obj=new FirstClass();


obj.myMethod(20,30);
obj.showMethod();
}

Multiple Scenarios

public class FirstClass {


Integer num1,num2, z;

//Member Methods
//1.create

public FirstClass(){
num1 = 0;
num2 = 0;

}
//2.Input
/*public void myMethod(Integer x, integer y){

num1=x;
num2=y;
}*/

//3.process
public void addition (){

z= num1+num2;//null null

}
//4. output
Public void showMethod(){
system.debug('the sum is '+ z); //null

@isTest
public class FirstClassTest {

public static testmethod void main(){

FirstClass obj=new FirstClass();//constuctor method


//obj.myMethod(20,30);
obj.showMethod();
obj.addition();

Constructor :-
-------------------

1) Class name and cunstuctor name must be same .

2) should not write any return type including void before constructor .

3) constructor main advantages is to initializ the values to the data members .

4) Constructor method will call only 1 time that is at the time object creation
only.

public class FirstClass {


Integer num1,num2, z;

//Member Methods
//1.create

public FirstClass(){
num1 = 0;
num2 = 0;

}
//2.Input
public void myMethod(Integer x, integer y){

num1=x;
num2=y;
}

//3.process
public void addition (){

z= num1 + num2;
}

//4. output
Public void showMethod(){
system.debug('the sum is '+ z);

@isTest
public class FirstClassTest {

public static testmethod void main(){

FirstClass obj=new FirstClass();


obj.myMethod(20,30);
obj.showMethod();
obj.addition();

obj.myMethod(200,300);
obj.showMethod();
obj.addition();

obj.myMethod(2000,3000);
obj.showMethod();
obj.addition();

at the time of declaration:....null null


at the constuctor method calling :....0 0
at the myMethod calling:..20 30

public class FirstClass {


Integer num1,num2;
Integer w;

//Member Methods
//1.create

public FirstClass(){
num1 = 0;
num2 = 0;

}
//2.Input
public void myMethod(Integer num1 , Integer num2){

this.num1=num1;//0 = 33 data members are dominates to the parameters values

this.num2=num2;//0 = 450
}

//3.process
public void addition (){

w= num1 + num2;

//4. output
Public void showMethod(){
system.debug('The sum is '+ w);

}
}

@isTest
public class FirstClassTest {

public static testmethod void main(){

FirstClass obj=new FirstClass();


obj.myMethod(33,450);
obj.showMethod();
obj.addition();

-----------------------------------------------------------------------------------
-------------------------

1 ) Can we write public , static , testmethod all these 3 keywords in any order
or not ?

----> Yes, We Can Write .

2) Can we write more than one testmethod in a single test class or not ?

----> Yes , We Can write .

public class FirstClass {


Integer num1,num2,w;

public FirstClass(){
num1 = 0;
num2 = 0;

public void myMethod(Integer num1 , Integer num2){

this.num1=num1;//0 = 35 data members are dominates to the parameters values

this.num2=num2;//0 = 45
}

public void addition (){


w= num1 + num2;

public void showMethod(){

system.debug('The sum is '+ w);

@isTest
public class FirstClassTest {

static public testmethod void main(){

FirstClass obj=new FirstClass();


obj.myMethod(35,45);
obj.addition();
obj.showMethod();

# While write the program , we need to follow some rules :


-----------------------------------------------------------------------------------
--------------
1) Class Name : Every word first letter should be in capital .
eg: firstclass -----FirstClass

2) method Name : first word first letter must be in lower case and second word
onwords
every word first letter should be in upper case .
eg: totalmarks()----> totalMarks();
this is called hungarian notation /camel notation.

3) for input we need to use setValues method .

4) For output we need to use getValues method .

5) for process we need to use any suitable name .

Que:- Write an Apex program to input student number , name ,3 subject marks ,
calculate total marks and Avg marks .

public class StudentClass {


// Data Members
Integer sno,m1,m2,m3,tm;
decimal am;
string sname;
// member methods
// 1.create
public StudentClass(){
sno = 0;
sname = 'no name';
m1 = 0;
m2 = 0;
m3 = 0;
tm = 0;
am = 0.0;

// 2.input
public void setValues(Integer no, STring name, Integer s1, Integer s2, Integer
s3){
sno = no;
sname = name;
m1 = s1;
m2 = s2;
m3 = s3;

}
// 3.process
public void totalMarks(){
tm = m1 + m2 + m3;

}
public void avgMarks(){
am= tm / 3;
}
// 4.output
public void getValues(){
System.debug('the total marks is ' + tm);
System.debug('the avg marks is ' + am);
}

@isTest
public class StudentClassTest {
public static testmethod void main(){
StudentClass obj = new StudentClass();
obj.setValues(101,'praveen',90,90,90);
obj.totalMarks();
obj.avgMarks();
obj.getValues();
}
}

----------------------------------------------------------------------------

Types Of Variables :
-----------------------
1) Local Variable :-
It is a variable which we can access only within the method and
outside the method we can't access.

2) non static/ object / Instance Variable :-


Object variable which we can access throught object name ,
by default every variable and every method of the class are not static
variable .
Non static variable are EXCLUSIVE for every object in the class .

3) static variable / Class Variable :


class variable which we can access throught class name ,
static variable are COMMON for every object in the class .

Non-Veg Hotel
TV----match ----Static variable

server1 server2 server3 server4 ----- non static


variables
tab1 tab2 tab3 tab4
ram pravin raju sham ------customer / Objects

count count count


raj ram amar

ICICI--- ATM -------Nashik

how much maintainace cost for each ATM ?

room rent--- 15 to 20k


security----15 to 20k *2
electricity --- 1000

60k

Collage road ----landmark -----

How many customers are using ATM every day.

>5000 people are using the ATM then will continue.

Code Right ----

public class BankAccountClass {

// data members -- non static


Integer ac_no, ac_bal;
String ach_name;
Integer static count = 0;
// member methods
// 1. create
public BankAccountClass(){
system.debug('i am in default constructor');
ac_no = 0;
ac_bal = 0;
ach_name = 'no name';
count++; // 1 2 3

}
/* public BankAccountClass(integer no, string name, integer balance){
system.debug('i am in parameterized construcor');
ac_no = no;
ach_name = name;
ac_bal = balance;
} */

// 2. input
public void setValues(integer no, string name, integer bal){
ac_no = no;
ach_name = name;
ac_bal = bal;
}

// 3. process
public void deposit(integer amt){
ac_bal = ac_bal + amt; // ' + ' operator acting like addition
operator / arithmatic operator
}
public void withdraw(integer amt){
ac_bal = ac_bal - amt;
}
// 4. output
public void balance()
{
system.debug('the balance is ' + ac_bal) ;
}
public void getValues()
{
system.debug('the account number is ' + ac_no); // concatination opertor
system.debug('the account holder name ' + ach_name);
system.debug('the balance is ' + ac_bal);
}

static static void getCount(){


system.debug('the number of customers are ' + count); //1
}
}

@isTest
public class BankAccountClassTest {

public static testmethod void main(){


BankAccountClass cust1 = new BankAccountClass();// creation of an object
i.e cust1
cust1.getValues();
cust1.setValues(101,'Raj',10000);
cust1.getValues();
cust1.deposit(10000);
cust1.balance(); //20000
cust1.withdraw(3000);
cust1.balance();// 17000
cust1.getValues();
BankAccountClass.getCount(); //1

BankAccountClass cust2 = new BankAccountClass(); // creation of an object


i.e cust2
cust2.getValues();
cust2.setValues(102,'Ram',20000);
cust2.getValues();
cust2.deposit(10000);
cust2.balance(); // 30000
cust2.withdraw(5000);
cust2.balance(); // 25000
cust2.getValues();
BankAccountClass.getCount(); //2

BankAccountClass cust3 = new BankAccountClass(); // creation of an object


i.e cust3
cust3.getValues();
cust3.setValues(103,'amar',50000);
cust3.getValues();
cust3.deposit(20000);
cust3.balance(); // 70000
cust3.withdraw(1000);
cust3.balance(); // 69000
cust3.getValues();
BankAccountClass.getCount(); //3
}
}

-----------------------------------------------------------------------------------
------
Polymorphysim:-
------------------------
poly---many
morph---forms

---> fuction/method name is only One and multiple operation


or
One name having Different forms .

# Real life Example of Polymopism :

Office ---Office Boy

bank deposit -----1


coffee----2
telephone call --3
electricity ----4

# We Can implement polymorphism in 4 ways ---

1) Constructor overloading :
2) Operator Overloading :
3) method Overloading :

Method Overloading Program


----------------------------------------------------------------------

public class MethodOverLoadingClass {


// Data memebers
Integer num1,num2,num3,num4,result;
// member methods
// 1.create
public MethodOverLoadingClass(){
num1 = 0;
num2 = 0;
num3 = 0;
num4 = 0;
result = 0;
}
//2. input
public void setValues(Integer a, Integer b){
num1 = a;
num2 = b;
}
public void setValues(Integer a, Integer b, Integer c){
num1 = a;
num2 = b;
num3 = c;
}
public void setValues(Integer a, Integer b, Integer c, Integer d){
num1 = a;
num2 = b;
num3 = c;
num4 = d;
}
//3. process
public Integer addition(){
result = num1 + num2;
return result;
}
public Integer subtraction(){
result = num1 - num2 - num3;
return result;
}
public Integer multiplication(){
result = num1 * num2 * num3 * num4;
return result;
}

@isTest
public class MethodOverLoadingClassTest {
public static testmethod void main(){
Integer res1,res2,res3;
MethodOverLoadingClass obj = new MethodOverLoadingClass(); // obj creation
obj.setValues(10,20);
res1 = obj.addition();
System.debug('the res1 value is' + res1); // 30
obj.setValues(10,20,30);
res2 = obj.subtraction();
System.debug('the res2 values is ' + res2); // -40
obj.setValues(10,20,30,40);
res3 = obj.multiplication();
System.debug('the res3 value is ' + res3); //240000
}
}

4) Method Overrinding :
-----------------------------------------------------------------------------------
-------------------

Encapsulation---Class , Interface
Abstraction ---private , public, globle , protected .
polymorphism---c.o, o.o, m.o
Inheritance ----
----------------------------------------------------------------------------------

Exception Handling :-
-------------------

Exception : Unwanted think that disturb the normal flow of programm.

compilation phase / Translation phase

Highlevel lang -----> IC ----> Lowleval lang--output--wrong output---no


output
(English)
source code machine code 3. bug 4.
exception

1.syntax error 2. semantic error

what is syntax error: if the programmer doesn't follow the rules of the lang then
it will display
the syntax error .
raise when fail to convert from HLL to IC

what is semantic error : if the statement doesn't have any meaning .

raise while program fails to convert from IC ti LLL

what is Bug: Wrong Output

Exception : No output

----
----

---- control abruptly come out of the program


----

Nashik Kasara// Igatpute


mumbai

try {

the statment which is root cause for the exception (Kasara)


}

catch {

Massage (Igatpuri)---

SBI ATM Card

10k ---15k

@isTest
public class ExceptionClass {

public static testmethod void main(){


Integer num1,num2,result; //local variable
try {
result = num1 + num2;
}
catch(exception e){
system.debug('Sorry we cannot add nulls ');
}
num1 = 10;
num2 = 0;
try {
result = num1 / num2;
}
catch(exception e){

system.debug('Stupide... We cannot divide the number by zero');


}
system.debug('The Sum is '+ result);
}
}

1) Null Pointer Exception : this exception will raise when user trying to perform
operation on null.

2) Arithmatic Exception : this exception will raise when user trying to divide the
number by zero .
-----------------------------------------------------------------------------------
-------------

Assertion:
------------
It is meant for Testing purpose .
IF any problem occures, then immediatly control comes out of the program .

Exception handling ----break


assertion ---exit

In Assertion there are 3 methods :

1. system.assert()
2. system.assertEquals()----this method itself contains = operator
3. system.assertNotEqual()-----this method itself contains != operator

@isTest
public class AssertClass {
public static testmethod void main(){
Integer num1,num2,result;
num1 = 10;
num2 = 10;
system.assert(num2!=0,'Sorry we cannot divide the no by zero');

// system.assertNotEquals(num2, 10, 'msg');

// system.assertEquals(num2, 0, 'msg');

}
}

-----------------------------------------------------------------------------------
-----------

# Annotations : It convey some meaning to the server .


--------------

@isTest: this annotation convey to the server saying that it is not a businees
class but it is
class test class.

OR
To define class or indivisual methods that only contains code used for Testing
the Application .

@future : this annotation convert the program from synchronous execution to


Asynchronous execution .

Synchronous Execution :

public class FutureClass {


public void fun1(){
system.debug('I Am in fun 1 starting ');
fun2();
system.debug('i am in fun1 ending ');
}

public void fun2(){


system.debug('i am in fun2 starting ');
system.debug('i am in fun2 ending');
}
}

Asynchronous Execution: multiple task can execute simultaneously.

public class FutureClass {


public void fun1(){
system.debug('I Am in fun 1 starting ');
fun2();
system.debug('i am in fun1 ending ');
}
@future
public static void fun2(){
system.debug('i am in fun2 starting ');
system.debug('i am in fun2 ending');
}
}

@isTest
public class FutureClassTest {
public static testmethod void main(){

FutureClass obj = new FutureClass();


obj.fun1();
}
}

@depreciated , @Readonly, @RemoteAction , .....etc


-----------------------------------------------------------------------------------
------------------
Database:-
------------
1) Data:- whatever we entered into the system is called Data .

2) Information:- Processed data can be called as Information./ meaningfull

3) Database :- collection of information stored at a particular place is known


as Database .

4) DBMS:(Database Management system)---it is a software which is present


inside the database , which can mainatain
and manages the data within the database .

I want a soap --- Super Market

Customer Sales girls


Super Market
User DBMS
D/B
SOQL---Salesforce Object Query Lang-- select
SOSL---Salesforce Object search Lang--- find

Select--This command is used to fectch the data from database .

syntax :
select f1,f2.....fn from <sobject name>
eg:
select name,ename__c,salary__c,job__c,deptno__c from employee__c

# Using Select Command we can fetch the data in 3 ways :

1) Projection : fetch the data from specific columns in the sobject is called
Projection.
eg:
select name,ename__c,salary__c,job__c from employee__c

2) Selection :Fetch the data from based on the Condition .


eg: --------------
select name,ename__c,salary__c,job__c from employee__c where deptno__c =5

3) Joins: fetch the data from more then one sobject .

q1) display the employees details who are working under deptno 10 and 20

eg: select name,ename__c,salary__c,job__c from employee__c where


deptno__c = 10 and deptno__c = 20

q2) display the employees details whose salary is between 10k to 15k

eg: select name,ename__c,salary__c,job__c from employee__c where salary__c > 70000


and salary__c < 100000

q3)display the employees details whose name contains only 5 letters.

eg: select name,ename__c,salary__c,job__c from employee__c where ename__c like


'______'

q4) display the employees details whose job name either start with man or end
with man
eg:
select name,ename__c,salary__c,job__c from employee__c where job__c like
'man%' or job__c like '%man'

q5)display the employees details who are not working as a manager .

eg: select name,ename__c,salary__c,job__c from employee__c where job__c !=


'manager'

q6) display the employees details whose name start with 's'

eg:select name,ename__c,salary__c,job__c from employee__c where ename__c like 's%'

q7) display the employees details whose name or job contains only 5 letters.

eg: select name, ename__c,salary__c,job__c from employee__c where ename__c like


'_____'
or job__c like '_____'
Assignments :-
--------------
1) Write an apex program input eid, ename , basic salary , hra , da , pf and tax
calculate
gross salary and net salary

gross salary = bs + hra+ da


net salary = gross salary -(pf+tax)

----------------------------------------------------------------------------------

Order by clause :
------------------
This clause is used to arrange the records in an Ascending or Descending
order.
Note :
-----
1. By default order by clause will arrange records in Ascending order .
2.we can apply the order by clause on any field in the sobject .
3.we can apply the order by clause on more than one field in the same
sobject .
4. if you want to arrange the records in descending order the we need to
use
an option call "desc"
------
Syntax :
----------
select f1,f2,....fn from <sobject name> order by <column name>

eg: select name, ename__c,salary__c,job__c from employee__c order by ename__c

select name, ename__c,salary__c,job__c from employee__c order by ename__c desc

select name, ename__c,salary__c,job__c from employee__c where salary__c<= 100000


order by salary__c desc

-----------------------------------------------------------------------------------
-----
# Group Functions:
------------------
1) sum(): this fuction finds the sum of all the values of a particular column in
the sobject
eg: select sum(salary__c )from employee__c

2) avg():this fuction finds the avg of all the values of a particular column in
the sobject
eg: select avg(salary__c )from employee__c

3) max(): this fuction returns the highest value of particular column in the
sobject.
eg:select max(salary__c) from employee__c

4) min():this fuction returns the lowest value of particular column in the


sobject.
eg: select min(salary__c) from employee__c
5) count():this fuction counts the number of records in the sobject .

this function contains 3 more fuctions.


1). count(): this fuction counts the number of records in the sobject including
duplicates and null.
eg: select count() from employee__c

2). count (column name):this fuction counts the number of records in the sobject
including duplicates but excluding null.

eg: 1. select count(ename__c) from employee__c


2. select count(deptno__C) from employee__c

3) count_distinct(column name): this fuction counts the number of records


excluding duplicates and nulls.

eg: select count_distinct(ename__c) from employee__c

-----------------------------------------------------------------------------------
-----------
# Group by Clause:
---------------
this clause is used tom divide records based category.

how many eployees are working ineach department


Group by clause --------- group functions/aggregate functions

eg: select deptno__C, count(name) from employee__c group by deptno__c

eg: select deptno__C, count(name),sum(salary__c),


avg(salary__c),max(salary__c),min(salary__c)
from employee__c group by deptno__c

eg: select job__C, count(name),sum(salary__c),


avg(salary__c),max(salary__c),min(salary__c)
from employee__c group by job__c

# This keywords used to display multiple grouping at a time .


1.cube
2.rollup

select deptno__C ,job__C,count(name),sum(salary__c), avg(salary__c) from


employee__c group by rollup
( deptno__c,job__C)

# Having Clause :
-------------------

eg: select job__c, count(name) from employee__c group by job__c having count
(job__c)>=2
select deptno__c, count(name) from employee__c group by deptno__C having
count(deptno__c)>=3

eg: select job__c, count(name) from employee__c where job__C='Manager' or


job__c='Developer'
group by job__c
having count (job__c)>=1
order by job__c desc

limit : It restrict the records while displaying sobject.

eg: select name,ename__c,salary__c,job__c from employee__c limit 7

Offset:

resulting records = total no of records - offset number


7 10-3

eg: select name,ename__c,salary__c,job__c from employee__c offset 5

# Differences between SOQL and SOSL:


-----------------------------------------------------

SOQL(Salesforce Object Query Language)


1)Using SOQL(select) we can Search only on one object at a time.
2)We can query on all fields of any datatype
3)We can use SOQL in Triggers and classes.
4)We can perform DML operation on query results.
5) select statement
6) it is specific search
7) we can write max 100 queries in a single apex class

SOSL(Salesforce object Search Language)


1)Using SOSL(find) we can search on many objects at a time.

2)We can query only on fields whose data type is text,phone and Email.

3)We can use in calsses but not in Triggers.


4)We cannot perform DML operation on search result.
5) find statement
6) it Is not specific search
7) we can write max 20 queries in a single apex class.

# Collection :
--------------
In Apex we have 3 types Collection classes ----All are predefined

1)List Class:
--------------------
a) It allows us to enter collection of values which are belongs to
same data type .
b) This class allows us to enter duplicate values.
c) The way how we enter the values, in the same way it will store.
Syntax:
List<Dtatype> objectname = new List<Datatype>();

eg:
List<integer> obj = new List<Integer>();
List<Decimal> obj = new List<Decimal>();
List<String> obj = new List<String>();
List<Account> obj = new List<Account>();
List<Employee__c> obj = new List<Employee__c>();

List Class and its Methods :-


1)Add()
2)add(index,value)
3)addAll()
4)set()
5)get()
6)clone()
7)sort()
8)size()
9)indexOf
10)remove()
11)clear()
12)contains()
13)isEmpty()
14)equal

For each loop Syntax:

for(datatype variable : objectname){

statement 1;

statement n;
}

@isTest
public class ListClass {
public static testmethod void main(){
List<Integer> obj = new List<Integer>();
obj.add(10);//1
obj.add(9);//2
obj.add(56);//3
obj.add(-9);//4
obj.add(12324);//5
obj.add(9);//6
obj.add(0,100);
obj.set(0,10000);//0
system.debug(obj);
System.debug('The Zeroth location Value is '+ obj.get(3));

for(Integer v : obj){

system.debug(v);

}
obj.sort();
system.debug('The sorted values are '+ obj);
List<Integer> obj1 = new List<Integer>();
obj1.addAll(obj);
system.debug('the new list values are '+ obj1);
system.debug('the no of values in the list as '+ obj1.size());
system.debug('the index value of is '+ obj.indexOf(10000));
obj1.remove(0);
system.debug(obj1);
obj1.clear();
system.debug(obj1);
Boolean flag= obj.contains(1000);
system.debug('the flag value is '+ flag);
boolean flag1= obj1.isEmpty();
system.debug('the flag 1 value is ' + flag1);

boolean flag2 = obj1.equals(obj);


system.debug('the flag 2 is ' + flag2);
List<Integer> obj2 = obj.clone();
system.debug(obj2);
}
}

2)Set Class :
-----------------

a) This class also allows tom user enter collection of values which are all
belongs to same data type .
b) This class doesn't allows Duplicate values
c) This Class Automatically arranges the values in ascending order .

Syntax:
---------
Set<datatype> objname= new Set<datatype>();

eg:
Set<integer> obj = new Set<Integer>();
Set<Decimal> obj = new Set<Decimal>();
Set<String> obj = new Set<String>();
Set<Account> obj = new Set<Account>();
Set<Employee__c> obj= new Set<Employee__c>();

@isTest
public class SetClass {
public static testmethod void main(){
Set<Integer> obj = new Set<Integer>();
obj.add(10);
obj.add(25);
obj.add(36);
obj.add(-80);
obj.add(25);
obj.add(467);
System.debug(obj);
Set<Integer> mySet = new Set<Integer>{1,3};
List<Integer> myList = new List<integer>{1,10};
Boolean res1 = mySet.removeAll(MyList);
System.debug(myList); //
System.debug(mySet); //
system.debug('the result is ' + res1);
Set<Integer> mySet1 = new Set<Integer>{1,3,77};
System.debug(mySet1); // 1 3 77
Set<Integer> mySet2 = new Set<Integer>{1,3,7};
Boolean result = mySet1.retainAll(mySet2);
System.debug(mySet1);
System.debug(mySet2);
System.debug(result);

}
}

3)Map Class :
--------------

1) This class allows us to enter dual values i.e key and value
2) this class also doen't allow us to enter duplicate keys but allows to
enter duplicate values
3) This Class Automatically arranges the values in ascending order .

Syntax:

Map <datatype,datatype> objname= new Map<datatype,datatype>();

eg:
Set<integer,integer> obj = new Set<Integer,integer>();
Set<Decimal,Decimal> obj = new Set<Decimal,Decimal>();
Set<String,String> obj = new Set<String,String>();
Set<integer,Decimal> obj = new Set<Integer,Decimal>();
Set<integer,String> obj = new Set<Integer,String>();

eg:

@isTest
public class MapClass {
public static testmethod void main(){
Map<integer,string> obj= new Map<integer,string>();
obj.put(1,'sindhu');
obj.put(2,'shasi');
obj.put(3,'upendra');
obj.put(4,'praveen');
obj.put(5,'mukul');
obj.put(1,'pallavi');
System.debug(obj);
Set<Integer> obj1 = new Set<Integer>();
obj1 = obj.keySet();
System.debug(obj1);
List<String> obj2 = new List<String>();
obj2 = obj.Values();
System.debug(obj2);
}
}

-----------------------------------------------------------------------------------
How to Perform CRUD operation on sobject using Apex Class:

CRUD---C = Create
R = Read
U = Update
D = Delete

-----------------------------------------------------------------------
Insert the record into employeee sobject using Apex class
----------------------------------------------------------------------
@isTest
public class InsertClass {
Public static testmethod void main(){
Employee__C obj = new Employee__C();
obj.ename__C = 'Chaudhari Vikas';
obj.salary__c = 2000;
obj.deptno__C ='20';
obj.job__c = 'Developer';
Insert obj;

}
}

# Update operation:
-------------------------

@isTest
public class UpdateClass {
public static testmethod void main(){

List<Employee__c> obj = new List<Employee__c>();


obj = [select salary__c from employee__c];
for(employee__c up : obj){
up.salary__c +=600;
}

Update obj;
system.debug(obj);
}
}

In Anonymous window :

List<Employee__c> obj = new List<Employee__c>();


obj = [select salary__c from employee__c];
for(employee__c up : obj){
up.salary__c +=6000;
}

Update obj;

# Delete operation :
----------------------------
@isTest
public class upClass {
public static testmethod void main(){
List<Employee__c> obj = new List<Employee__c>();
obj = [select id from employee__c];
Delete obj;
}

--------------------------------------------------
# UnDelete operation :

@isTest
public class upClass {
public static testmethod void main(){
List<Employee__c> obj = new List<Employee__c>();
obj = [select id from employee__c all rows];
unDelete obj;
}

-----------------------------------------------------------------------------------
----

# Upsert Operation :

List<Employee__c> obj = new List<Employee__c>();


obj = [select salary__c from employee__c];
for(employee__c up : obj){
up.salary__c +=35000;
}

Employee__C obj1 = new Employee__C();


obj1.ename__C = 'Balu';
obj1.salary__c = 10342;
obj1.deptno__C = '20';
obj1.job__c = 'clerk';
obj.add(obj1);
Upsert obj;

-----------------------------------------------------------------------------------
------------------

# VisualForce :--
-------------------
1) It is a markup lang like HTML, using this lang we can develop static
user interface .
2) Visualforce markup lang is all about combination of many Components.
3) Components mens , it is similar to tags in HTML Lang.

4) tag means commands , and there are 2 types of tags .

i.e Open tag closing tag

< > </ >

5) We can combine HTML tags directly with Visualforce . It means we can


directly use
HTML tags in Visualforce program.

6) Using Salesforce standard user interface we can perform only limited


operations ,
but if you want to perform thr operations as per businees need, we need to
create our own user interface.

7) Visualforce user interface override the fuctionalities of salesforce


standard user interfaces.
# Syntax Of Visualforce :
-- -- -- -- -- -- -- --

<prefix:componentname attribute1="value"
attribute2="value"..............attributen="value">

</prefix:componentname>

eg:
<apex:page sideBar="true" >

</apex:page>
-----------------------------------------------------------------------------------
-----
Structure of Visualforce program :

<apex:page>
<apex:pageBlock>
<apex:pageBlockSection>
<apex:pageBlockSectionItem>

</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

# We We can write the visualforce program in 4 places :

1) Developer console:
User menu -->Developer Console -->file --> new --> Visualforce pages -->new

<apex:page >
<b> Amol<br/></b>
Sandip<br/>
Bhupendra<br/>
Mukul
</apex:page>

2) Standard Navigation:

setup -->Build-->Develop--> Lighting component-->Visualforce page --> New


<apex:page >
<h1>Congratulations</h1><br/>
Arti<br/>
shubham<br/>
Kanchan<br/>
Sambhaji<br/>
Sanket
</apex:page

3) URL: We need some setting


User menu--> my setting-->personal-->advance User Details-->edit -->development
mode --> check

<apex:page >
<h1>Congratulations</h1><br/>

Sambhaji<br/>
Umesh<br/>
Shreyash<br/>
Arti<br/>
Unnati
</apex:page>

4) Eclips/ Visual Studio code

1) Page Component and its attributes:


-----------------------------------------

1) sideBar
2) showHeader
3) action
4) tabStyle
5) renderer
6) renderedAs
7) recordSetVar
8) controller
9) Standardcontroller
10) Extention

<apex:page sideBar="true" showHeader="true" rendered="true"


tabStyle="Employee__c">

<h1>Congratulations</h1><br/>

Sambhaji<br/>
Umesh<br/>
Shreyash<br/>
Arti<br/>
Unnati
</apex:page>

<apex:page sideBar="true" showHeader="true" rendered="true"


tabStyle="Employee__c" action="http://www.bookmyshow.com">

<h1>Congratulations</h1><br/>

Sambhaji<br/>
Umesh<br/>
Shreyash<br/>
Arti<br/>
Unnati
</apex:page>

---------------------------------------------------------------------------------

2) # sectionHeader:
-------------------
1) Title
2) subtitle
3) Help
4) description
eg:
<apex:page >
<apex:sectionHeader title="Students " subtitle="BIkkad IT soft Pvt Ltd"
help="http://www.amazon.com"
description=" Welcome to Bikkad It Software Institute"/>
Sambhaji<br/>
Umesh<br/>
Shreyash<br/>
Arti<br/>
Unnati
</apex:page>

3) # CommandLink and its attributes:


----------------------------------
1) title
2) action
3) style
4) Value

<apex:page >
<apex:form >
<apex:sectionHeader title="Students " subtitle="BIkkad IT soft Pvt Ltd"
help="http://www.amazon.com"
description=" Welcome to Bikkad It Software Institute"/>
Sambhaji<br/>
Umesh<br/>
Shreyash<br/>
Arti<br/>
Unnati <br/>
<apex:commandLink action="http://www.cricbuzz.com" style="color:red"
value="Click Here" title="IF you click here it takes you on cricbuzz site" />
</apex:form>
</apex:page>

-----------------------------------------------------------------------------------
-------
4) # Page Block , pageBlock Buttons & Command Buttons

<apex:page >
<apex:form >
<apex:pageBlock title="Student List">
<apex:pageBlockButtons >
<apex:commandButton value="Save" style="color:green;background:white"/>
<apex:commandButton value="Cancel" style="color:red;background:white"/>
</apex:pageBlockButtons>
Sambhaji<br/>
Umesh<br/>
Shreyash<br/>
Arti<br/>
Unnati <br/>
</apex:pageBlock>
</apex:form>
</apex:page>
5) Input Component:
------------------
text boxes ----
radio buttons-----
check boxes------
list boxes ----
text area box -----
secret box -----
hidden box

eg:

<apex:page >
<apex:form >
<apex:sectionHeader title="Students " subtitle="BIkkad IT soft Pvt Ltd"
help="http://www.amazon.com"
description="Bikkad IT Students"/>
<apex:pageBlock title=" Students Information">
<apex:pageBlockButtons >
<apex:commandButton value="SAVE"/>
<apex:commandButton value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="Student Details">
<apex:pageBlockSectionItem >
<apex:outputLabel Value="First Name"/>
<apex:inputtext />
</apex:pageBlockSectionItem><br/>
<apex:pageBlockSectionItem >
<apex:outputLabel Value="Last Name"/>
<apex:inputtext />
</apex:pageBlockSectionItem><br/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Age"/>
<apex:inputText />
</apex:pageBlockSectionItem><br/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Contact Number"/>
<apex:inputText />
</apex:pageBlockSectionItem><br/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Email Id"/>
<apex:inputText />
</apex:pageBlockSectionItem><br/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="User Name"/>
<apex:inputText />
</apex:pageBlockSectionItem><br/>

<apex:pageBlocksectionItem >
<apex:outputLabel value="Password"/>
<apex:inputSecret />
</apex:pageBlockSectionitem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Qualification"/>
<apex:selectList size="1">
<apex:selectOption itemLabel="Under Graduate"
itemValue="UG"/>
<apex:selectOption itemLabel="Graduate" itemValue="G"/>
<apex:selectOption itemLabel="PG" itemValue="PG"/>
<apex:selectOption itemLabel="PhD" itemValue="PhD"/>
</apex:selectList>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Gender"/>
<apex:selectRadio >
<apex:selectOption ItemLabel="Male" ItemValue="M"/>
<apex:selectOption ItemLabel="FeMale" ItemValue="F"/>
</apex:selectRadio>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Hobbies"/>
<apex:selectCheckboxes >
<apex:selectOption itemLabel="Reading Books" itemValue="RB"/>
<apex:selectOption itemLabel="Playing Tennis"
itemValue="PT"/>
<apex:selectOption itemLabel="Listning Music"
itemValue="LM"/>
<apex:selectOption itemLabel="Stamp Collection"
itemValue="SC"/>
</apex:selectCheckboxes>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Address"/>
<apex:inputTextarea cols="30" rows="5"/>
</apex:pageBlockSectionItem>

</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Controllers:
------------

As as now we created Static UI using VF

if you want to convert static UI to Dynamic UI then we need to combine Apex


Class(Controller Class)
program with static VF pages

Dynamic Page = static page + Apex Class

Controllers givesfuctionality for the Static page

There are 6 types of Controllers in Apex class


i.e
1) Statndard Controller
2) Custom Controller
3) Statndard list Controller
4) Custom list Controller
5) Statndard Set Controller
6) Extention Controller

# 1) Statndard Controller :
------------------------
1) Standard controller gives standard functionalities such as
Insert, Update , Delete , select (CRUD Operation)

2) when we are working with standard controller we need to use predefined


attribute
called "StandardController" which is belongs to "Page component"

3) The advantage of standard controller is Developer no need write seperate Apex


class (Controller class) program,
because standard having the inherint functionalities such as insert ,update ,
delete, and select.

4) But the limitation of standard controller is Using this we can perform only
these 4 Operations

1) Insert a record into employeee sobject using Standard Controller .


------------------------------------------------------------------------------
how many textboxes are requiered ?-->> number of fields in sobject--4

how many buttons we needed? --->> number of Operations ---2

eid ename salary deptno job

Save cancel-------

ex:

<apex:page standardController="Employee__c" tabStyle="Employee__c" >


<apex:form >
<apex:sectionHeader title="Students " subtitle="BIkkad IT soft Pvt Ltd"
help="http://www.amazon.com"
description="Bikkad IT Students"/>
<apex:pageBlock title=" Employee Information">
<apex:pageBlockButtons >
<apex:commandButton value="SAVE" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="Employee Details">
<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee Name"/>
<apex:inputfield value="{!Employee__c.Ename__c}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee Deptno"/>
<apex:inputfield value="{!Employee__c.Deptno__c}"/>
</apex:pageBlockSectionItem><br/>
<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee Salary"/>
<apex:inputfield value="{!Employee__c.salary__c}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee job"/>
<apex:inputfield value="{!Employee__c.Job__c}"/>
</apex:pageBlockSectionItem><br/>

</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

-----------------------------------------------------------------------------------
--------------
<apex:page standardController="Employee__c" tabStyle="Employee__c" >
<apex:form >
<apex:sectionHeader title="Students " subtitle="BIkkad IT soft Pvt Ltd"
help="http://www.amazon.com"
description="Bikkad IT Students"/>
<apex:pageBlock title=" Employee Information">
<apex:pageBlockButtons >
<apex:commandButton value="SAVE" action="{!save}"/>
<apex:commandButton value="SAVE N NEW" action="{!quickSave}"/>
<apex:commandButton value="EDIT" action="{!edit}"/>
<apex:commandButton value="DELETE" action="{!delete}"/>
<apex:commandButton value="CANCEL" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="Employee Details">
<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee Name"/>
<apex:outputField value="{!Employee__c.Ename__c}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee Deptno"/>
<apex:outputField value="{!Employee__c.Deptno__c}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee Salary"/>
<apex:outputField value="{!Employee__c.salary__c}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee job"/>
<apex:outputField value="{!Employee__c.Job__c}"/>
</apex:pageBlockSectionItem><br/>

</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
To fetch data using above program we need to type the following URL:

https://bikkadit-dev-ed--c.vf.force.com/apex/fetch_sc?id=a005g00003C0LzW

-----------------------------------------------------------------------------------
----------------

2) Custom Controller :
-------------------

->>> custom controller enhance the limitation of standard controller using custom
controller,
we can perform all kinds of businnes operations

--->> When we are working with custom controller we need to write a seperate apex
class
(Controller class)

---->> When we are working with custome controller we need to use an attribute
called "Controller"
which is belongs to page component.

# Arithmetic Operation Using Custom Controller :


---------------------------------------------------

1.create -- contructor method ---object creation--test class --no need to write


create method
2.input--setValues-input
3.process -- addition(),multi(),SUb(),Div(),reminder(),
4.output--getValues--output

PageReference:-- It refers to some other page

Web Application ---Contains group/collection of web pages

-----------------------------------------------------------------------------------
----------
<apex:page controller="MathOperations" tabStyle="Student__c" >
<apex:form >
<apex:pageBlock title=" Arithmatic Operation">
<apex:pageBlockButtons >
<apex:commandButton value="ADD" action="{!addition}"/>
<apex:commandButton value="SUB" action="{!substraction}" />
<apex:commandButton value="DIV" action="{!division}"/>
<apex:commandButton value="MUL" action="{!multiplication}" />
<apex:commandButton value="MOD" action="{!remainder}"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="Arithmetic Page">
<apex:pageBlockSectionItem >
<apex:outputLabel Value="first Number"/>
<apex:inputText value="{!num1}" />
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Second Number"/>
<apex:inputText value="{!num2}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Result"/>
<apex:inputText value="{!result}" />
</apex:pageBlockSectionItem><br/>

</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

------

public class MathOperations {


// Data Members
public Integer result { get; set; }

public Integer num2 { get; set; }

public Integer num1 { get; set; }

// data methods
public PageReference remainder() {

result = math.mod(num1,num2);

return null;
}

public PageReference multiplication() {


result = num1 * num2;
return null;
}

public PageReference division() {


result = num1 / num2 ;
return null;
}

public PageReference substraction() {


result = num1 - num2;
return null;
}

public PageReference addition() {

result =num1 + num2;


return null;
}
}
-----------------------------------------------------------------------------------
-----------------------

Insert the record into Employeee sobject using Custom controller :


-------------------------------------------------------------------------------
<apex:page controller="Insert_Class" tabStyle="Employee__c" >
<apex:form >
<apex:pageBlock title=" Employee Information">
<apex:pageBlockButtons >
<apex:commandButton value="SAVE" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="Employee Details">
<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee Name"/>
<apex:inputText value="{!Ename}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee Deptno"/>
<apex:inputText value="{!Edeptno}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee Salary"/>
<apex:inputText value="{!Esalary}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel Value="Employee job"/>
<apex:inputText value="{!Ejob}"/>
</apex:pageBlockSectionItem><br/>

</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

public class Insert_Class {

public String Ejob { get; set; }

public Double Esalary { get; set; }

public String Edeptno { get; set; }

public String Ename { get; set; }

public PageReference cancel() {


return null;
}

public PageReference save() {


Employee__C obj= new Employee__C();
obj.ename__c =Ename;
obj.deptno__C =Edeptno;
obj.salary__c =Esalary;
obj.job__C =Ejob;
Insert obj;
return null;
}

-----------------------------------------------------------------------------------
-----------

Fetch the Data from Employeee sobject using Custom controller :


-----------------------------------------------------------------------------------
---------------

<apex:page controller="Fetch_Class">
<apex:form >
<apex:pageBlock title="Employee Details">

<apex:pageblockButtons >
<apex:commandButton Value="FETCH" action="{!fetch_record}"/>
</apex:pageblockButtons>

<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Employee ID:"/>
<apex:inputText value="{!empid}"/>
</apex:pageBlockSectionItem><br/>
</apex:pageBlockSection>
</apex:pageBlock>

<apex:pageBlock title="Employee Information">


<apex:pageBlockSection title="Employee Details">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Employee ID:"/>
<apex:inputText value="{!eid}" />
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Employee Name:"/>
<apex:inputText value="{!empname}"/>
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Employee Salary:"/>
<apex:inputText value="{!empSalary}" />
</apex:pageBlockSectionItem><br/>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Employee Job:"/>
<apex:inputText Value="{!empJob}"/>
</apex:pageBlockSectionItem><br/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Employee DeptNo:"/>
<apex:inputText value="{!empDno}" />
</apex:pageBlockSectionItem><br/>

</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

public class Fetch_Class {

public String empDno { get; set; }

public String empJob { get; set; }

public Double empSalary { get; set; }

public String empname { get; set; }

public String eid { get; set; }

public String empid { get; set; }

public PageReference fetch_record() {

Employee__C obj =new Employee__C();

obj = [select name,ename__c,salary__C,job__c,deptno__c from employee__C where


name like:empid];

eid= obj.name;
empname= obj.ename__c;
empSalary= obj.salary__c;
empJob = obj.job__c;
empDno = obj.deptno__c;

return null;
}

Delete the Data from Employeee sobject using Custom controller :


-----------------------------------------------------------------

<apex:page controller="Delete_Class">
<apex:form >
<apex:pageBlock title="Employeee Details">
<apex:pageBlockButtons >
<apex:commandButton value="DELETE" action="{!delete_record}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Employee ID"/>
<apex:inputText value="{!EmpID}"/>
</apex:pageBlockSectionItem>

</apex:pageBlockSection>
</apex:pageBlock>

</apex:form>
</apex:page>

public class Delete_Class {

public String EmpID { get; set; }

public PageReference delete_record() {

Employee__C obj=new Employee__C();


obj=[select id from employee__c where name like :EmpID];
Delete obj;
return null;
}

update the record into Employeee sobject using Custom controller :


-----------------------------------------------------------------------------------
---------------------

The comman point between the standard and custom controller is at a time we can
fetch only 1 record .

Standard List and Custom list controller

when we are working with standard or custom list controllers, then we need to use
a predefined components
called as

1) Data List
2) Data Table
3) PageBlock Table

All these 3 components purpose is same i.e fetch multiple records , but
when we are working with standard list controller then we need to used a
predefine attribute call
"recordSetVar" which is be;long to Page Component.

List<Employee__C> obj = new List<Employee__C>();


obj = [select name,ename__c,salary__c,job__c,deptno__c from Employee__c];
for(Employee__c er: obj){
System.debug(er);
}

recordSetVar="obj"== List<Employee__C> obj = new List<Employee__C>();


obj = [select name,ename__c,salary__c,job__c,deptno__c from Employee__c];

<apex:dataList var="er" value="{!obj}"> ==for(Employee__c er: obj)

<apex:outputField value="{!er.Job__c}"/>== System.debug(er);

1) Data List:

<apex:page StandardController="Employee__c" recordSetVar="obj">


<apex:form >
<apex:pageBlock title="Data List">
<apex:dataList var="er" value="{!obj}">
<apex:outputField value="{!er.name}"/> &nbsp; &nbsp;&nbsp;&nbsp;
<apex:outputField value="{!er.Ename__c}"/> &nbsp; &nbsp;&nbsp;&nbsp;
<apex:outputField value="{!er.salary__c}"/>&nbsp; &nbsp;&nbsp;&nbsp;
<apex:outputField value="{!er.Deptno__c}"/>&nbsp; &nbsp;&nbsp;&nbsp;
<apex:outputField value="{!er.Job__c}"/> &nbsp; &nbsp;&nbsp;&nbsp;
</apex:dataList>

</apex:pageBlock>
</apex:form>
</apex:page>

2) Data Table :

<apex:pageBlock title=" Data Table">


<apex:dataTable var="er" value="{!obj}" cellspacing="5" cellpadding="5"
border="3">
<apex:column headerValue="EID"/>>
<apex:outputField value="{!er.name}"/>
<apex:column headerValue="ENAME"/>>
<apex:outputField value="{!er.Ename__c}"/>
<apex:column headerValue="SALARY"/>>
<apex:outputField value="{!er.salary__c}"/>
<apex:column headerValue="DEPTNO"/>>
<apex:outputField value="{!er.Deptno__c}"/>
<apex:column headerValue="JOB"/>>
<apex:outputField value="{!er.Job__c}"/>

</apex:dataTable>
</apex:pageBlock>

3) PageBlock Table :

<apex:page standardController="Employee__c" recordSetVar="obj" >


<apex:form >
<apex:pageBlock title="Data List">
<apex:DataList var="er" value="{!obj}">
<apex:outputField
value="{!er.name}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<apex:outputField
value="{!er.Ename__c}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;
<apex:outputField
value="{!er.Salary__c}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;
<apex:outputField
value="{!er.Job__c}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<apex:outputField value="{!er.deptno__c}"/>
</apex:DataList>

</apex:pageBlock>
<apex:pageBlock title="Data Table">
<apex:DataTable var="er" value="{!obj}" cellSpacing="5" cellPadding="5"
border="3">
<apex:column headerValue="EID">
<apex:outputField value="{!er.name}"/>
</apex:column>
<apex:column headerValue="ENAME">
<apex:outputField value="{!er.Ename__c}"/>
</apex:column>
<apex:column headerValue="SALARY">
<apex:outputField value="{!er.Salary__c}"/>
</apex:column>
<apex:column headerValue="DEPTNO">
<apex:outputField value="{!er.deptno__c}"/>
</apex:column>
<apex:column headerValue="JOB">
<apex:outputField value="{!er.Job__c}"/>
</apex:column>
</apex:DataTable>

</apex:pageBlock>
<apex:pageBlock title="PageBlock Table">
<apex:pageBlockTable var="er" value="{!obj}">

<apex:column headerValue="EID">
<apex:outputField value="{!er.name}"/>
</apex:column>
<apex:column headerValue="ENAME">
<apex:outputField value="{!er.Ename__c}"/>
</apex:column>
<apex:column headerValue="SALARY">
<apex:outputField value="{!er.Salary__c}"/>
</apex:column>
<apex:column headerValue="DEPTNO">
<apex:outputField value="{!er.deptno__c}"/>
</apex:column>
<apex:column headerValue="DESIGNAION">
<apex:outputField value="{!er.Job__c}"/>
</apex:column>

</apex:pageBlockTable>

</apex:pageBlock>
</apex:form>
</apex:page>

# Custom List Controller:-


-------------------------

The limitation of standard list controller is we can't fetch Specific records


Using Standard List Controller.

If you fetch specific records then we need to used Custom list Controller.

<apex:page controller="CLCClass2">
<apex:form >
<apex:pageBlock title="Data List">
<apex:dataList var="er" value="{!obj}">
<apex:outputText
value="{!er.name}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<apex:outputText
value="{!er.Ename__c}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;
<apex:outputText
value="{!er.Salary__c}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;
<apex:outputText
value="{!er.Job__c}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<apex:outputText value="{!er.Deptno__c}"/>
</apex:dataList>
</apex:pageBlock>
<apex:pageBlock title="DATA TABLE">
<apex:dataTable var="er" value="{!obj}" border="2" cellspacing="2"
cellpadding="2">
<apex:column headerValue="EID">
<apex:outputText value="{!er.Name}"/>
</apex:column>
<apex:column headerValue="ENAME">
<apex:outputText value="{!er.Ename__c}"/>
</apex:column>
<apex:column headerValue="SALARY">
<apex:outputText value="{!er.Salary__c}"/>
</apex:column>
<apex:column headerValue="DEPTNO">
<apex:outputText value="{!er.deptno__c}"/>
</apex:column>
<apex:column headerValue="DESIGNATION">
<apex:outputText value="{!er.Job__c}"/>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
<apex:pageBlock title="PAGE BLOCK TABLE">
<apex:pageBlockTable var="er" value="{!obj}" >
<apex:column headerValue="EID">
<apex:outputText value="{!er.name}"/>
</apex:column>
<apex:column headerValue="ENAME">
<apex:outputText value="{!er.Ename__c}"/>
</apex:column>
<apex:column headerValue="SALARY">
<apex:outputText value="{!er.Salary__c}"/>
</apex:column>
<apex:column headerValue="DEPTNIO">
<apex:outputText value="{!er.deptno__c}"/>
</apex:column>
<apex:column headerValue="DESIGNATION">
<apex:outputText value="{!er.Job__c}"/>
</apex:column>
</apex:pageBlockTable>

</apex:pageBlock>
</apex:form>
</apex:page>

# Apex Class :

Public class CLCClass2{

Public List<Employee__C> Obj{set,get}

public List<Employee__C> getObj(){

return [select name,ename__c,salary__c,job__c,deptno__c from Employee__c


where deptno__c like '10'];
}

-----------------------------------------------------------------------------------
---------------------------------------

class MyClass1 {

above program display error


top level must have public and globle visibility

public class MyClass1 {


public class InnnerClass{

}
}

Note: we can write a class within a class.

public class MyClass1 {


public class InnnerClass{
public class InnerMostClass{

}
}
}
the above program shows the error
Inner Types are not allow to have inner types .

public class MyClass1 {


public class InnnerClass1{

}
public class InnerMostClass2{

}
}

Note: We can write N number of individual inner classes.

//businees Logic
public class MyClass1 {
public class InnnerClass1{

}
public class InnerMostClass2{

}
}

@isTest
public class MyClass1Test {

static public testmethod void main(){

MyClass1 obj = new MyClass1(); // object creation of outer class


MyClass1.InnnerClass1 obj2 =new MyClass1.InnnerClass1();//object creation of
inner class
MyClass1.InnerMostClass2 obj3 =new MyClass1.InnerMostClass2();
}
}
Note : We can't access inner class directly . if you want to access inner class
that
we can access only through top level/Outer Class.

# Interface:
-----------
O.S : it is a s/w which acts like an interface b/w USER and CPU

user O.S computer

It connects 2 things just like Bridge

Encapsulation: class , Interface

Class : Data members + member methods

Interface: method prototype ,It contains some set of services.

Application(Apex)----------------Interface----------------------ARE (Apex
runtime Engine)
In Apex , We no need to create any Interface , Here evertthing is predefine.

Syntax of Create An Interface :-


-----------------------------------

Interface <interfacename>{

method prototype;
}

but we need combine interface with class .

Class <classname> implements <interfacename>{

data members
+
member methods
+
method prototypes

API :- Application Programming Interface

public class MyClass2 {


public interface Ifname {

}
}

Note: We can write an interface within class but we can't write class within
interface

public class MyClass4 {


//members methods
public static void fun1(){
system.debug('Sambhaji');
}

public void fun2(){


system.debug('Mansi');
}

Public class InnerClass2{


//members methods
public static void fun3(){
system.debug('Avi');
}
public void fun4(){
system.debug('Arihant');
}

}
Note : The abpve program shows error message :
Static can only be used on methods of top level type

It means we can't make inner class methods are static


only outer class methods we can .
-----------------------------------------------------------------------------------
------------------

# Schedule Apex :
------------------
Event: Some action / operation

There are 2 Types Of events


1) User Based Events: event will perform based on user interaction
businees Class
Test Class ---run test button

2) Time Based Events: some action are perform Automatically based on time without
user interaction.

i want to wakeup at 5 am everyday , Alarm automatically start and ringing .

Ex: I want to insert a new record into Employee sobject every day 9pm

--->> When we are working with schedule Apex we need to use a predefined
Interface called "Schedulable"
and we need to use a predefined method called "execute"

How to Schedule :
Setup--> build -->Develop --> Apex Classes --> schedule Apex-->

# Batch Apex:-
------------

Multitenant Architecture:
--------------------------

multi-- more than one


tenant-- people living side by side

Multiple people are living side by side ----Apartment

Green Park Residency

5 floors
5 flats
25 families --Comman place

25 ---car---

drew the lines -- Governor limits

501 502 503 504 ---


memory space
For One sobject
500 field
25 -- lookup
2--master details
13---
40 --relationships

As per the GL , we can update only 10000 records at a time.

Lakhs --- every month 1 govement of india , create there salaries in there
accounts

70k pension
50k + 70k = 120k

One class room ---25 students

100 ---Student

100/25 ---4 batches

who implemets GL = salesforce


who given Batch Apex= salesforce

50000/10000 ---5 batches


1 to 10000--- 1 Batch
1 ---10000---2 batch

After completion of one batch , the moment the controll goes to next batch ,
immediately the GL will RESET to 1 again .

The default size of batch 200 and maximum batch size is 2000

Batch Size ---total number of records in each batch.

When we are working with batch Apex we need to use a predefined Interface
called
"batchable" which is belongs to top level/Outer class called "Database".

And we need to use 3 Predefined Methods Called ...

1) Start --- The job of start method is, if fetches all the records at a time
from sobject and
give it to execute method .

2) execute-- The job of execute method is, it perform the operations on the
records batch by batch.

3) Finish -- the job of fishin method is, it acknowledges the user , saying
that the job has
accomplished

Start --1 TIME


execute -- N number of time depending on number of batches.
finish-- 1TIME
public class BeyondGL implements database.Batchable<Employee__C>{
// 1.Start
String name= 'Sambhaji';
public Iterable<Employee__C>start(database.batchableContext bc){
system.debug('I am in Start Method'+ name);// Sambhaji
name = 'Arihant';
return[select salary__c from Employee__C];
}
//2.execute

public void execute (database.BatchableContext bc, List<Employee__c> obj){


system.debug('I am in execute method'+name);// Arihant
name= 'Rushikesh';
for(Employee__c er: obj){
er.salary__c +=10000;
}
Update obj;
}
//3. finish

public void finish(database.BatchableContext bc){


system.debug('i am in finish method' + name); //Rushikesh
}
}

In the above program , All three methods prints only the name "Sambhaji"
because By default Batchapex is "STATELESS".

Stateless: Variable value can't override with new value


so, we need to make it as "STATEFUL"

public class BeyondGL implements


database.Batchable<Employee__C>,database.stateful{
// 1.Start
String name= 'Sambhaji';
public Iterable<Employee__C>start(database.batchableContext bc){
system.debug('I am in Start Method'+ name);// Sambhaji
name = 'Arihant';
return[select salary__c from Employee__C];
}
//2.execute

public void execute (database.BatchableContext bc, List<Employee__c> obj){


system.debug('I am in execute method'+name);// Arihant
name= 'Rushikesh';
for(Employee__c er: obj){
er.salary__c +=10000;
}
Update obj;
}
//3. finish

public void finish(database.BatchableContext bc){


system.debug('i am in finish method' + name); //Rushikesh
}
}

To execute program :
BeyondGL obj = new BeyondGL();
database.executeBatch(obj);

Start -- 1 time -- sambhaji


1 2 3 4
execute ---3 batch --4 times -- Arihant Rushikesh Rushikesh Rushikesh

Finish ---1 time -- rushikesh

BeyondGL obj = new BeyondGL();


database.executeBatch(obj,3);

public class SalaryClass implements Schedulable {


public void execute(SchedulableContext sc){

BeyondGL obj = new BeyondGL ();


database.executeBatch(obj,3);
}

public class BeyondGL implements


database.Batchable<Employee__C>,database.stateful{
// 1.Start
String name= 'Sambhaji';
public Iterable<Employee__C>start(database.batchableContext bc){
system.debug('I am in Start Method'+ name);// Sambhaji
name = 'Arihant';
return[select salary__c from Employee__C];
}
//2.execute

public void execute (database.BatchableContext bc, List<Employee__c> obj){


system.debug('I am in execute method'+name);// Arihant
name= 'Rushikesh';
for(Employee__c er: obj){
er.salary__c +=10000;
}
Update obj;
}
//3. finish

public void finish(database.BatchableContext bc){


system.debug('i am in finish method' + name); //Rushikesh
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

String[] toAddress = new String[]{'@gmail.com','@gmail.com'};

mail.setToAddresses(toAddress);
mail.setSubject('Batch Apex Job Completed');
mail.setPlainTextBody('Batch Apex Job Accomplished Successfully');
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
}
}

-----------------------------------------------------------------------------------
-----------------
# Triggers :
------------

Gun-- arc ---Bullet fires and hit the target

x ------ Protect Myself

1) Trigger is Apex Program which is going to stop / restrict invalid data which
is entered by the
End User to implement businnes rules and also Trigger Automatically performs
DML operations on sobject.

1) Stop / restrict Invalid data --- Validation


2) Performs some DML operations Automatically --- Automation

befor--- Validation
After ---- Automation

Automation means automatically perform some operations without user interface .

2) Trigger Always fires against DML operations only, trigger never fires against
Select operation .

3) DML ---Insert , Update , Delete...

4) Fire : Some piece of code automatically perfoms

5) Validation means before performing the Transaction


Automation means after performing the Transaction

6) for performing validation and automation we need to use Trigger Context


Variable(TCV)

7) Trigger Context Variable are of 2 Types:

a) Database Trigger Context Variable :


1) isBefore---true, false
2) isAfter ---false, true
3) isInsert---true ,false ,false,false
4) isDelete---false,true,false,false
5) isUpdate---false,false,true,false
6) isundelete---false,false,false,true

true -- false ----Boolean

b) Event Base Context Variable : 5 Types

New ----- New version of values


old ----- old version of values
Employee:
eid ename salary deptno ------records ---100 ---10 records --20
deptno--old
90
deptno--new
newMap
oldMap
size

Syntax of Trigger Context Variable


-----------------------------------------------------------------------------------
--------------

trigger.tcv

EX:

trigger.old
trigger.new
trigger.isBefore

Structure of Trigger Program :


-----------------------------------------------------------------------------------
-------------

trigger <trigger name> on <sobject name> (befor/after DML){

statement 1;

statement 2;

-----------------------------------------------------------------------------------
------------

1) Write a trigger program to stop insert operation on Course sobject if fees is


less than 500.

trigger MyTrig1 on course__c (before insert) {


List<Course__c> obj = new List<Course__C>();
obj = Trigger.new;
for(Course__C er: obj){
if(er.fees__c<500){
er.fees__c.addError('Sorry we cannot insert the record fess is less
than 500');
}
}

2) Write a trigger program to stop update operation on Course sobject if fees is


less than 500.

trigger MyTrig1 on course__c (before update) {


List<Course__c> obj = new List<Course__C>();
obj = Trigger.new;
for(Course__C er: obj){
if(er.fees__c<500){
er.fees__c.addError('Sorry we cannot insert the record fess is less
than 500');
}
}

3) Write a trigger program to stop Insert and update operation on Course sobject if
fees is less than 500.

trigger MyTrig3 on course__c (before insert,before update) {


List<Course__c> obj = new List<Course__C>();
obj = Trigger.new;
for(Course__C er: obj){
if(er.fees__c<500){
er.fees__c.addError('Sorry we cannot insert/update the record fess is
less than 500');
}
}
}

4) Write a trigger program to stop delete operation on Course sobject if fees is


more than 3000.

trigger MyTrig4 on course__c (before delete) {


List<Course__c> obj = new List<Course__C>();
obj = Trigger.old;
for(Course__C er: obj){
if(er.fees__c>3000){
er.fees__c.addError('Sorry we cannot Delete the record fess is more
than 3000');
}
}

5) Combine 3 operation perform :

trigger MyTrig5 on Course__c (before insert,before update, before delete) {


List<Course__c> obj = new List<Course__c>();
if(Trigger.isInsert == True || Trigger.isUpdate == True){
obj = Trigger.new;
for(course__c er : obj){
if(er.fees__c < 500){
er.addError('sorry we cannot insert or update records fees is <
500');
}
}
}
else
if(Trigger.isDelete == True){
obj=Trigger.old;
for(Course__C er : obj){
if(er.fees__c > 3000){
er.addError('sorry we cannot delete costly records');
}
}
}
}

6) If we want to Not perform operation in specific day

trigger MyTrig7 on Employee__c (before insert,before update, before delete) {


DateTime dt = system.now();
List<Employee__c> obj = new List<Employee__c>();
if(Trigger.isInsert == True || Trigger.isUpdate == True){
obj = Trigger.new;
for(Employee__c er : obj){
if(dt.Format('EEEE')== 'Friday'){
er.addError('sorry we cannot Perform Operation on Friday');
}
}
}
else
if(Trigger.isDelete == True){
obj=Trigger.old;
for(Employee__C er : obj){
if(dt.Format('EEEE')== 'Friday'){
er.addError('sorry we cannot perform operation on friday');
}
}
}

-----------------------------------------------------------------------------------
---------------------------

Que: Write a trigger to update account sobject phone number field ,when we insert a
new record into contact sobject.

Loookup relationship

Account(Parent)
Contact(child)

there are 2 comman fields

Phone
Account name

trigger PhoneUpdateTrigger on Contact (after insert) {

List<Account> obj = new List<Account>();


for(Contact c:Trigger.new){
Account a =[select id,phone from Account where id = :c.AccountId];
a.phone = c.Phone;
obj.add(a);
}
update obj;
}

-----------------------------------------------------------------------------------
--------------------

1) Integration :
----------------

Exchanging of data between the Applications in a heterogenous environment .

2) Why we need to go for Integration:


------------------------------------

There are 2 resions need to go for Integration

1) One transaction can Spread across multiple organozation to perform the


Transaction Successfull.

Suppose , I want buy a cell phone through online ---Task

chrome browser --> amazon.com-->Iphone-->navigate multiple models of Iphone --


>finally i selected I phone 14-->
amount gets deducted from my bank Account(HDFC)-->i got confimation massage -->on
my mobile --> Courier(Blue dart-10days)--
--> GE-->customer care
1 2 3 4 5
Browser--> Amazon.com-->Iphone-->bank payment gateway HDFC-->Blue Dart--> GE
php SAP-sales finacle oracle Logistic SF CRM

through all these companies are using Diff tech they can exchange the inform b/w
them and eachn other
they can communicate with each and make sure that the transaction successfull
completed .

Here where Integration Come into the picture

2) One transaction can Spread across multiple Departrmentrs to perform the


Transaction Successfull.

KFC
mkt -- Adv
sales --5 Lakh
HR --Employee
finance-- Monetory trasaction

3) Patterns Of Integration :
-------------------------
a) Tightly Coupling :

HR(SAP-workbook)

mkt(SAP-mkt) middleware finance (Oracle-


fico)
sales(salesforce- crm)

EAI-- Enterprise Application Integration


Act as like POC/ common hub

Vendor Companies Developes EAI:


SAP ---XI/PI
microsoft ---Biztalk
TIBCO-- the information Bus Company
90% telecom companies in india , TIBCO

b) loosely Coupling :

HR(SAP-workbook)

mkt(SAP-mkt) WebServices finance (Oracle-


fico)

sales(salesforce- crm)

Web Service---set of Standards

but here between every pairs have some Interface

Standard always specify what we have to do but never specify how to do.

3 types

1) SOAP
2) REST
3) BULk

4) History of Integration :
-------------------------------

root point is ---function only

Parts Of functios:
-----------------------

1) Calling point 2) Definition point

main (){
--
--

---
---
totalmarks();// calling point
--
--
--

definition point
totalmarks(){
--
---
--
---
}

C Lang --- calling point and sub program both residing in the same program .

java ---- 2000 --RMI -- Remote Method Invocation

prog 1 prog 2
calling point sub program
sub program calling point

WebServices

App 1 App 2
calling point sub program
sub program calling point

SOAP API :
----------

app1 (sf/apex) definition point


-------------------------------------
class <class name> {

public totalmarks(){

app2
(SAP/ABAP)

---------------------
calling
point

In SOAP API , we have 3 Components


1) HTTP-- Hyper text Transfer protocol
2) WSDL-- webservices descriptiion lang
3) UDDI-- universal description discovery Integration

apex----119 line code


app1(dp)-->WSDL(XML)--> HTML--> WSDL --> Generate --> app2(cp)
step 1 2 3 4

SOAPClass(dp) MySOAPClass(cp)

-----------------------------------------------------------------------------------
----------------------

CRUD Operation :
------------------
1)Insert operation into in Employee sobject using SOAP API:
-------------------------------------------------------------

global class InsertSoap {

webservice static void insert_record(){

Employee__C obj= new Employee__c();


obj.Ename__c = 'Raj Kumar';
obj.Salary__c = 88888;
obj.Job__c = 'Analyst';
obj.Deptno__c = 20;
Insert obj;

InsertSoapClass.InsertSoap obj = new InsertSoapClass.InsertSoap();


Obj.SessionHeader=new InsertSoapClass.SessionHeader_element();
obj.SessionHeader.sessionID=userinfo.getSessionId();
InsertSoap.insert_record();

2) Update operation into in Employee sobject using SOAP API:


-------------------------------------------------------------

global class UpdateSoap {


webservice static void update_record(){

List<Employee__C> obj= new List<Employee__c>();


for(Employee__c er: obj){
er.salary__c+=15000;
}
Update obj;
}
}

UpdateSoapClass.UpdateSoap obj = new UpdateSoapClass.UpdateSoap();


Obj.SessionHeader=new UpdateSoapClass.SessionHeader_element();
obj.SessionHeader.sessionID=userinfo.getSessionId();
UpdateSoap.update_record();

3) Fetch operation into in Employee sobject using SOAP API:


-------------------------------------------------------------

global class FetchSoap {


webservice static void fetch_record(){
List<Employee__C> obj = new List<Employee__c>();

obj = [select name, ename__C, salary__c,job__C, deptno__C from employee__C];

for(Employee__C er : obj){
System.debug(er);
}

FetchSoapClass.FetchSoap obj = new FetchSoapClass.FetchSoap();


Obj.SessionHeader=new FetchSoapClass.SessionHeader_element();
obj.SessionHeader.sessionID=userinfo.getSessionId();
FetchSoap.fetch_record();

4) Delete operation into in Employee sobject using SOAP API:


-------------------------------------------------------------
global class DeleteSoap {
webservice static void update_record(){

List<Employee__C> obj = new List<Employee__c>();

obj = [select id from employee__C];

Delete obj;
}
}

DeleteSoapClass.DeleteSoap obj = new DeleteSoapClass.DeleteSoap();


Obj.SessionHeader=new DeleteSoapClass.SessionHeader_element();
obj.SessionHeader.sessionID=userinfo.getSessionId();
DeleteSoap.update_record();

5) unDelete operation into in Employee sobject using SOAP API:


-------------------------------------------------------------
global class UndeleteSoap {
webservice static void undelete_record(){

List<Employee__C> obj = new List<Employee__c>();

obj = [select id from employee__C all rows];

Undelete obj;
}
}

UndeleteSoapClass.UndeleteSoap obj = new UndeleteSoapClass.UndeleteSoap();


Obj.SessionHeader=new UndeleteSoapClass.SessionHeader_element();
obj.SessionHeader.sessionID=userinfo.getSessionId();
UndeleteSoap.undelete_record();

6) Upsert = Update + Insert using SOAP API :


----------------------------------------------

-----------------------------------------------------------------------------------
-------------------------------

REST API:
----------
In SOAP API ,every time we need to convert the program into nuetral
lang(WDSL).
it is overhead . so we need to use REST API
In Rest API we need to use some predefined Annotations ie.

1) @RestResource ---convert the class into rest resource


2) @HttpGet--- Fetch
3) @HttpPost--- Insert
4) @HttpPut--- Upsert
5) @HttpPatch-- Update
6) @HttpDelete-- delete

@isTest and @future

Definition point
-------------------------------------
class <class name> {

public void greetings(){

calling point

-----------------------

3rd
party App called Workbench

json
code--Javascript object notation

-----------------------------------------------------------------------------------
-----------------------------

1) Insert Operation Using REST API :

@RestResource(URLMapping='/RestPage')
global class RestClass {

@HttpPost
global static void Insert_record( String ename,Double sal, Integer dno , String
job ){

Employee__C obj = new Employee__C();


obj.Ename__c = ename ;
obj.Salary__c = sal ;
obj.Deptno__c = dno ;
obj.Job__c = job ;
Insert obj;
}
}
2) Abstraction / Access Modifires :
---------------------------------

Abstarction we can achive using 4 keywords


1) Private: the members (data members + member methods) of this abstraction could
be visible and accessible
only within the encapsulation(Class)

2) Public : the members of this abstarction could be visible and accessible in


the entire Org.
3) global : the members of this abstarction could be visible and accessible in
the entire SFDC.
4) Protected : the members of this abstarction could be visible and accessible in
the another
encapsulation(Class) which is parent and child relationship .

Syntax of Abstraction :

abstarction <data member>


abstraction <member methods>

eg:

private Integer srno ;


public void totalMarks(){

By Default All member of the class are in Private abstarction .

Note: At the class level , Data members should always private abstraction and
member methods are always
public abstraction .

-----------------------------------------------------------------------------------
----------

In Apex Class devided into two parts :

1) Business Class --definition point

---> This contains the actual businees logic

2) Test Class --- calling point

---->It contains object definition ,through which we can execute the business
class .

BC always executed via TestClass

To distinguish between businees class and test class is , every test class start
with an
annotation is "@isTest"

Annotation :It conveys some meaning to the server.

Abtraction / Modifires :

Private
Public
Protected
Global

Acccessibility Level

Private < Protected < public < Global

public class TestClass {

String name = 'Raj';

public void read(){

system.debug('Read Name is '+ name);

---> Dyanamically Class created

public class TestClass {

public void read( String name ){

system.debug('Read Name is '+ name);

# Inheritance :
---------------

Relation ---Parent and Child

Create a new class from existing class

1.Reusibility of code from the derived class? subclass

2.Virtual And extends keywords

3.we are not going to create an object of Parent class .


4.if you want to execute the class method you can call the child class.

# Polymorphism:- One name having different forms .

poly ---many

morph --changing one stage to another stage

There are 2 Types of Polymorphism:-

1) Static polymorphism / Early Binding / Method overloading :

`method name same but method Arguments/parameters are different in a same class .

public class MethodOverloading {

public void show(){


system.debug('show method without parameter');
}
public void show(Integer i){
system.debug('show method with one Integer parameter');
}
public void show(Decimal j){
system.debug('show method with one Decimal parameter');
}
public void show(Integer i,Decimal j){
system.debug('show method with one Integer and Decimal parameter');
}
public void show(Decimal j,Integer i){
system.debug('show method with one Decimal and Integer parameter');
}
}

MethodOverloading obj = new MethodOverloading();


obj.show(22.7,45);
/*obj.show(10);
obj.show(10.5);
obj.show(10,10.5);
obj.show(10.5,10);*/

public class MethodOverloading {

public void show(){


system.debug('show method without parameter');
}
public void show(Integer i){
system.debug('show method with one Integer parameter');
}
public void show(Decimal j){
system.debug('show method with one Decimal parameter');
}
public void show(Integer i,Decimal j){
system.debug('show method with one Integer and Decimal parameter');
this.show(50);
}
public void show(Decimal j,Integer i){
system.debug('show method with one Decimal and Integer parameter');
this.show(77.89);
}
}

MethodOverloading obj = new MethodOverloading();


obj.show();
//obj.show(10);
//obj.show(10.5);
obj.show(10,10.5);
obj.show(10.5,10);

2) Dnyanamic polymorphism / Late Binding / Method Overrinding :

--> Existing functionality Replace by New functionality

Virtual keyword
override keyword

1. we can override only parent child relations


if it is same class we cannot override

2. Mothod names and method paremeters or method signature must be same .

public virtual class PreviousScore {

public virtual void score(){


system.debug('Old score is 155 ');
}
}

public class CurrentScore extends PreviousScore{

public override void score(){


system.debug('New score is 999');
}

// Case 1
CurrentScore ci = new CurrentScore();
ci.score();
// case 2
PreviousScore p = new PreviousScore();
p.score();
// case 3
PreviousScore pc = new CurrentScore();
pc.score();

-----------------------------------------------------------------------------------
---------------------------
encapsulation
Abstarction
Inheritance
polymorphism
-----------------------------------------------------------------------
Final keyword
static block
Instance block
constructor----- default and parameterized
Abstarct Class
Interface
Super
this

-------------------------------------------------------------------------
Changes compare with Java
sytsem.debug();
extends & virtual
public static testmethod void main(){
}
integer
private

----------------------------------------------------------------------------

Final Keyword :-

final Integer no=12;


system.debug('No== '+no);

system.debug('No== '+no);

Instance Block
{
// Code
}

Static Block

static {
// code
}

Constructor --- 1) Default Constructor


2) Parameterized Constructor

modifire <classname>(){

----> Constructor name is same as Class name ,


----> It is a spcial type of method ,
---- > Constructor Does not contained any return type .

Instance Block:-
----------------
--> They are associated with a particular object.
--> They have no definition modifire.
--->They are created with every object Instantiated from the class in which
they are declared

Syntax:

Instance Block
{
// Code
}

Sequence of Execution :

static
Instance
constructor
obj

Static Block :-
----------------
--> They are associated with a Class
--> They are allowed only in outer classes
--> Thy are initialized only when a class is loaded.
public class Car {

Private static Integer MAX_SPEED;

{
System.debug('Instance Block ');
MAX_SPEED =70;
}
static {

system.debug('Static Block Executed');


}

public Car(){
system.debug('Max Speed '+ MAX_SPEED);
}

public Car(String model , String typex){

system.debug('Max Speed '+ MAX_SPEED);


system.debug('Car model '+ model);
system.debug(' Car Type '+ typex);
}

Car obj= new Car();


system.debug('--------------');
Car obj1= new Car('Maruti','BS-6');
system.debug('--------------');
Car obj2= new Car('Hyndai','BS-4');

-----------------------------------------------------------------------------------
-------------------------------------------------
Abstract Class:- To hide somethimg in the class with the method .

---> when you write a method you will not keep semocolon but abstract class methods
we keep a semicolon.
---> when in any class if at list one method is abstract then we must need to make
that class as Abstract .
---> In Abstract class we can write both Abstract method as well as concreate
method

Syntax:

public abstract class Classname {

public void show(){

System.debug('welcome to the abstract class');

public abstract void wish();

Ex:

public abstract class AbstractClassDemo {

public void show(){


system.debug('Welcome to Abstract Class');
}
public abstract void wish();

public abstract class AbstractClassDemo1 extends AbstractClassDemo {

public override void wish(){


system.debug('I am using Abstraction method');
}
public abstract void display();

public class AbstractClassDemo2 extends AbstractClassDemo1 {

public override void display(){

system.debug('This is Child abstract using class');


}
}

AbstractClassDemo2 obj = new AbstractClassDemo2();


obj.display();
obj.show();
obj.wish();
-----------------------------------------------------------------------------------
---------------------

Interface :- It contains only denifinition without imolementation .

public Interface InterfaceDemo {

void show();
void wish();
string display();

public class InterfaceDemo1 implements InterfaceDemo{

public void show(){


system.debug('Show method');
}
public void wish(){

system.debug('wish method');
}

public String display(){

String result = 'Welcome to Apex';

return result;

Super Keyword :

public virtual class ParentClass {

public Integer p = 678 , q= 987 ;

public virtual void add(){


integer a = 10, b= 20 , c ;
c= a+b;
system.debug(c);

public class ChildClass extends ParentClass{


public Integer p=500, q= 2000 ;

public override void add(){


Integer c = super.p +super.q;
system.debug(c);
}

Assignment :
Wrapper Class:
Diff b/w Abstract class and Interface
This keyword
-----------------------------------------------------------------------------------
------------------------------

CRM: Customer Relationship Management

Gols Of CRM : Retain the existing customer and grab the new customer in the
businees.

Retain : Existing should always stick with company/ product .

CRM: is the combination of 3 things


1) Marketing --pre sales
2) Sales
3) Service -- post Sales

CRM Tracks the customers every transaction , creating a single view of the
customer make easy to,
connect through calls and emails.

CRM is not related to customer , it is also able to manage all of our businees
relationships , customers ,
partners and employees and parteners so that increase our companies productivity.

Why we need to use CRM :


----------------------

Enterprise App = BA + CRM + Integrated App

Why SF CRM is Number 1 CRM in the world why not others ??


--------------------------------------------------------

2 types of CRM

1) On premise CRM :
we need to install the CRM s/w in our local machine and use it .
eg: Seibel CRM, Microsoft Dynamic CRM, Oracle CRM

2) Cloud Base CRM :


we no need to Install this CRM s/w everything provide by vendor companies obver
the Cloud .

eg: Sugar CRM , Salesforce CRM .

SFDC CRM is Plain cloth


18 sObjects ---
Mkt Cycle start
1) Compaingn
2) Lead
Mkt Cycle end

sales cycle start


3) Accounts
4) Contact
5) Opportunites
6) Products
7) Price books
8) Quote
9) Contract
10) forecast
11) order
12) Assets
sales cycle end

service cycle start


13) Cases
14)Solutions
service cycle end

15) Activities
16) Task
17) event
18) Calendar

1) Compaign:- Mode Of Advertisement

we can do MKt diffrent ways

ie. TV adds , Papare ads , Hoardings , radio , mounth talk , social media ....

Scenario:
---------

26 Jan --- Repblic Day

Sambhaji working as a director in INFOR --Pune

you want to give some gift to your employees who performs well in the last year .

1000---employees

100 -- Project managers ---Iphones 14 --100*100000---> 1 Cr


400 -- team leads ---- IPad -- 400 ---400*50000 ----> 2 Cr
500 -- developers ---- Apple Watches --500*40000---> 2 Cr
---------
5 Cr

10k discount on each product


100 -- Project managers ---Iphones 14 --100*90000---> 90 Lakh
400 -- team leads ---- IPad -- 400 ---400*40000 ----> 1cr 60 lakh
500 -- developers ---- Apple Watches --500*30000---> 1 cr 50 lakh
-------------
4 Cr

Infor Conducted Some campaign In Pune ground on th occassion of Repblic Day

2) Lead : it could be a person or company or an Organization who shows


interested in our product or businees .

This sobject stores the information about the lead , using this information we
can reach the lead again and again

It contains the information about lead such as :

name of the lead ,


contact no ,
emaild ,
fax no
Company address
Company phone no
land line no

3) Account : it is nothing but the company/ organisation from where our leads are
originate .

4) Contact : Information related to person from we can expected the businees

Note: Sometime lead and contact both could be same or different .

5) Opportunity : It is the revenue pontential of the lead

means how much businees we can expect from this lead

Campaign(26 Republic day -pune)->lead(sambhaji)-->account (INFOR)-->


contact(Sambhaji)-->Opportunity(INFOR-)

6) Product : It is a unit of service /Businees that being sold

7) Price Book : Price Variation of the product.

8) Forecast : The businees in the pipeline

9) Quote: It is a documents , which contains th information about details such as

product name,
price
Shipping charges
Discount
Tax(GST)
Grand Total

10) Contract : It is an Agreement b/w the current company(Apple) and an account who
has accepted our Quote (INFOR)
Campaign(26 Republic day -pune)->lead(sambhaji)-->account (INFOR)-->
contact(Sambhaji)-->Opportunity(INFOR-)
product--> Price book---> forecast--->quote---Contract-->

11) order: It is the work engagement to start the processing .

12) Assets:
house ---Rent ---u will get rent income

w.r.t. CRM ---how many products we have send to our customer

"The number of products /units that we have sold to our customer in the businees
"

1000---products
Campaign(26 Republic day -pune)->lead(sambhaji)-->account (INFOR)-->
contact(Sambhaji)-->Opportunity(INFOR-)
product--> Price book---> forecast--->quote---Contract--> order--> Assets

-----------------------------------------------------------------------------------
--------------------------
Service Cycle

we sold the assets to our customers , and now our assets with them , so we need to
secure our assets .
we are the safe gurds of out assets,
because we are the creators or manufacturs of our products , but once we sold
the assets to our customers ,
they might face some problems or challenges .

these challenges technically called as "Cases"

13) Case: it means the challenges facing by our customers .

14) Solution :
-----------------------------------------------------------------------------------
------------

All these 14 sobjects are pertaining to salesforce CRM

but thre are other 4 sobjects , they are throughout salesforce .

one tab is comman for every application on salesforce , what is that ?

Home Tab

app and Tab ---many to many

tab and sobject --- one to one

because every tab is internally connected with only one sobject .

Tab sobject

Accounts Account
Leads lead
contacts contact

Home --- connected with an sobject called "Activity"

this sobject 'activity' is connected with every other sobjects in the salesforce.

if you open any sobject ,any record there we can see 'open activities' and
'activity history'

Activity sobject has internally 2 more sobject .


i.e Task and Event

Task : It means 'what you have to do '


eg: tomorrow i nned to meet Sambhaji ---this os my task

Event : when i have to do this work ?


eg: tomorrow i nned to meet Sambhaji at 9 pm at his office ----this is Event

So activity is the combination of Task + Event

Event sobject internally connected with another sobject called " Calendar "

Activities--
Task
Event
Calendar

-----------------------------------------------------------------------------------
-----------------------------

Admin
Lightning (Aura Componant / LWC )
mini Projects on Admin Part And Developement Part
Resume Creation / Profile
Mock Interviews

Allow to give interview


-----------------------------------------------------------------------------------
---------------------

Admin --- 2 weeks

# Roles & responsibilities of System Administrator:-


--------------------------------------------------
The whole admin topic we devided into 4 parts

1) Data Management
2) Dtaa Automation & Approvals
3) Data Analysis
4) Data Security

# 1) Data Management :- we can import the data and export data from external
system to
Salesforce and Salesforce system to External System using some tools like Data
Import Wizard ,
and Data Loader .
How many ways we can insert the record into sobject ??

1) New
2) Apex programming
3) VF pages
4) Schedule Apex
5) Batch Apex
6) Triggers
7) Integration

But In all these 7 ways we can insert only 1 at a time , but if you want to
insert multiple records
at a time into sobject , then we need to use Data Management Tools .

1) Data Import Wizard :

--> This is a internal tool which is given by salesforce and it is used to perform
import operation.
--> Using this tool we can Only perfoirn 3 operations on sobject:

1) Insert 2) Update 3) Upsert (Upxdate + Insert)

---> Using this tool we can perform the operations on only 50K
---> Using this tool we can perform the operations on only 5 standard sobjects and
all custom sobject .

Note : very soon data Import wizard is going to be vashined/ obselete

1) Insert:
Import : Moving the data from external system to salesforce sobject.

here external system means .csv file

csv --- comma seperated value

Employeee

eid ename salary(>25k) job deptno


Auto Number

On sobject -----validation Rules , Triggers

---> we need to Map when csv field names and sobject names are different
---> We need to map , if it is same

2) Update:
1) first we need to export the data from sobject to .csv file.
2) we need to do some modification in csv file.
3) we have to import the data from csv file to sobject.

Export : Moving the data from salesforce sobject to external system .

3) Upsert : Update + Insert -- Externals Id

# Data Loader : -- 50k t0 5 Million


--> 7 operations we can perform using Data Loader

Insert
update
upsert
export
exportAll
delete
Hard Delete

Export: it will export only sobject records into .csv file

ExportAll : it will export the records from sobject and recycle bin records as well
.

-----------------------------------------------------------------------------------
------------------------------------

2) Data Automation And Approvals :


--------------------------------

Automation : Automatically Perform some operation without interaction /


interference of the human .

i want to trasper some amount from my account to another account --- OTP to my
registered mobile.

deposit / withdraw some amount from my account --- SMS on my mobile

Salesforce given Some tools Are --

1) Workflows
2) Process builder
3) Flow Builder

# WorkFlows : it is a tool , which is used to perform automations without


developer's assistance/ need .

W.r.t. Workflows will discuss about the following points :


------------------------------------------------------------

1) what are workflow Rules ?


-------------------------------

A) It is a container/ businees logic engine that automatic certain action based


upon some conditions/criteria .

B)whenever we create(insert) a record/update a record, the workflow action which is


active on the particular sobject
gets evaluated.

Condition -----True --- then workflow action what we applicate


|
false
no action will perform, simply
records gets inserted/update in the sobject

C) action will perform immediately , the moment the record gets inserted /updated
or action will perform after
specific time , if the condition is satisfied

D) Immediate Action : These actions immediately executed , when the records gets
inserted /updated .

Time Dependent Action: these are the action that will executed after certain
period of time .

ABC .co CEO --

10 Pm

E) Conditions : 3 Types of Evalution Criteria


1) ctreated
2) created and everytime its edited
3) created ant time its edited to subsequently meet the criteria.

===>> Workflow Can perform 4 Actions :

1) Email Alerts
2) Assign Task
3) Field Update
4) outbound Message

Email Templetes :

1) Standard Templete : Which is given by salesforce

2) custome Templete : which is created by Developer

2 ) When to Use ?

3) How to create ?

4) Limitations of workflows ?

5) point that you need to consider with workflow rules ?

2) Field Update :
scenario:
change the employee job as Analyst if job is Manager

3) Outbound message :----Integration--- end point URL---destination Address ---

sending the data from one application to another application.


SF ---------
4) Assign Task:

Sony TV ------3 years Warrenty

-------------------------------------

Customer care --- TV details ---Ticket gen ---48 hrs

Pune --------------- Mumbai center

Customer care ---

server centre-----multiple tencians--free

Dange chowk --------------- Aundh

-----------------------------------------------------------------------------------
-------------------

2) Process builder :-

This 2nd Automation tool which is given by salesforce and it contains 11


actions .
Out of 11 actions 2 actions are common between worflow rule and process builder
i.e Email Alert and Field Update

1) Email Alert :-

2) field Update :
change the closed date field value when stage field value = closed won and
amount is
greater than 5 Lakh on opportunity sobject.

3) Create a record :

Insert a new record into Account sobject if we create a new record in


opportunity sobject if stage is close won

Opportunity Account
stage = close won Insert

4) Post to chatter:

when we inserted new record into account sobject ,if type =customer-direct then

post the information into chatter box .

sobject = Account
condition: type = customer-direct

5) Approval Process :

i want personal loan --bank -- Approve / reject

COVID-- X-- Hospital ---10 days


bill discharge summary
-----------------------------------
BillId :101--Auto Number
Doctor Fee: currency
nurse fees :currency
medicine fees: currency
Diagnostic charges : currency
ICU rent : currency
Total Bill: currency
Bill Concession : Picklist--Yes , No , Wait
----------------------------

petient ask bill discount

Rule : if any total bill is more that 1 lakh then he is eligible for discount

-----------------------------------------------------------------------------------
--------------------------

3) Data Analysis -- Reports & Dashboards ---BI --Businees Intellegence

Report:
------

Report is formal documents written for a specific audience to meet specific need.

Salesforce Given 4 Types od Reports :


1) Tabular Report
2) Summary Report
3) Matrix Report
4) Joined Report

Note : Every report should store in a specific folder.


Note : We can't create a chart in Tabular Report

Summary Report: Group by Clause

Matrix Report: It is grouping records both row/column wise .

-----------------------------------------------------------------------------------
-----------------------
# Dashboards: It is place where we store / place more than one reports.

OR
Dashboard is main canvas where we can store collection of Reports.

So , that we can view multiple Reports At a time

Ex:
CEO of the company , I just want to know sales Report of last year quarterly
wise .

Quar1 Quar2 Quar3

-----------------------------------------------------------------------------------
-----------------------

Data Management
Data Automation
Data Analysis

# Data Security :
-----------------

Data Security---
Org level security
App Level security
Tab Level security
Object level Security
Field Level security
Record Level security
OWD--Org wide defaults
Role Hierarchies
Sharing Rules
Manual Sharing

how to create An account for a particular user by system Administrator ?


-----------------------------------------------------------------------------------
--------

System Admionistrator:

Full name : Bikkad IT


user name : batch02@bi.com
password:
profile : System Administrator
Role :
License :

Note : In developer edition we have only 2 salesforce License .

# What is profile, Types of Profile and How to ctreate a profile , Assign the
profile to specific user :

Profile : Set of permissions / collection/ Group of permission.

There Are 2 types of profile :

1) Standard profile : Given By Salesforce

2) Custom profile : Created by Developer/ SA

Custmise profile we can modify as per our Requirements .


Note : Custome profile always created based on Standard Profile.

It means , we need to clone

clone means Duplicate copy

We Can controle User through profile only , so profile is more powerful .

--> One User Can have only 1 profile.

One prifile we can assign to multiple users

1) App Level Security:

CRUD operaion

2) Tab Level Security :

3 Types of tab level security

1) Default On : if it is on, then user can access tab


2) Default Off : if it is Off ,then user can't access tab in tab bar ,but he can
see and
access the tab in the list of all tabs.

3) Tab hidden : it is hidden , then user can't access the tab in the tab bar and
also in the list of all tabs

3) Object level security :

Generally on Sobject we can perform CRUD operation

Employee__C

insert/create read/view update/edit delete

4) Field Level Security :


--------------------------

How many ways we can give the field level security :


3 Ways Types
1) while creating the field.
2) while creating the Page layout.
3) through Profile.

BikkadIt --- maintains students information in one sobject called "Student"


-----------------------------------------------------------------------------------
--

sid sname Qualification emailId dob contact no course name

Level Managements
high level ---Director, CEO ,
mid level ---Managers , Team leaders
Low level---clarks, student management staff , cordinators ,house kiping boy

1) Read only
2) Read & write (edit)

5) Record Level Security :


----------------------------
OWD ---Organization Wide Defaults

private -- No view, edit , delete


public read only --only view but nor edit and delete
public read/write-- view and edit but not delete
full access -- view , edit, delete, change the ownership
controlled by Parent---

Role Hierarchy
Sharing rules
Manual Sharing

Note : If we want to make use of Record Level security you make sure that view
all and
modify all permission in the profile level should be unchecked .

Permission Set
public group
Queues
Flow --flow builder

# Sharing rules:

Some special permission / privillege .

OWD-- private ---No view /Edit

Sambhaji gives personally requsted to system Adminitrator , give Deptno = 30

# Manual Sharing :

if one user asking the permission on a specific record in the sobject ,


then we need to use Manual Sharing option.

# Role:
-------
job/ Designation

roles are of 2 types

1) Standard Role : Given By salesforce


2) Custom Role : Created by developer

Sambhaji--User --- Training Head

Trainer 1 --Arihant
Trainer 2---Pooja

Roles & Subordinates

# Org Level Security :

Password policies
Login IP Ranges
Login Hours
Business hours
holidays setting
location setting
Fiscal year setting
currency setting
Apex class
VF page acess

IP Adress 101.0.0.1

Permission Set
public group
Queues
Flow --flow builder
SOOL

# Permission Sets:
------------------

--> Permission sets extends/Additionaly the fuctionality of users without


changing there profile.

---> Object permission


field permission
User permission
Tab permission
App permission
Apex class permission
VF pages permission

User Permistion Set


|
|
Profile
10 users

5 Users+ 20 ex users----- PS1


5 Users-------PS2

# Public Groups:
---------------
--> public group consist of set of users/ Roles/ Roles & Sub Ordinates / Public
Groups .

-->These are created to group users who have different profiles .

# Queues:
--------

---> Queues nothing but a location which holds a collection of Records for some
time are in waiting state.

data box --customer(Queues) Queue members--System Admin

----> Leads,Cases, feedback ----standard sobject ----Applicable for Queues


-----> for all Custom objects we can apply Queues .

--> Queues ---features

1) Queue supporting sobjects

2) Queues Members

We can apply sharing rules to the Queues Also .

-----------------------------------------------------------------------------------
----------------------------

# Flow Builder:-

---> Flow is most powerful Automation tool provided by salesforce .


---> Using Flow we can perform various task same as in workflow and Process
builder as well it peform sendinf Emails,
Posting a chatter , sending the custom Notificatios ......etc
---> Flow can be triggers for record insert,update and delete and oit can be run
for both after and before events .

There are mainly 2 types of flows :

1) Screen
2) Auto Lanched ----devided into 4 types
a) Scheduled Trigger
b) Record trigger
c) Platfoem Event Trigger
d) Auto lanched (No --trigger)

# Flows Componants :
Mainly 3 types
A) Interaction
1) Screen
2) Action
3) Sub Flow

B) Logical
1) Assignment
2) Decission
3) Loop
4) Collection Sort

C) Data (SFDC)
1) Create Record
2) Update Record
3) Delete Record
4) Get Record

-----------------------------------------------------------------------------
Scenarios:

1. Create a flow to display the welcome message to the user.


2. modify the flow and display the user name and then show greeting message.
3. Add the flow into the Home Page
4. Modify the flow to show dynamic message.

-----------------------------------------------------------------------------------
-
# Lightning :- Aura and LWC Componants

-->> Aura Componant : -

HTMl , JS , CSS

MVC--- Model View Controller

Model : Created apps , tabs , sobject ,fields , relationships, validation


rules , page layouts, record types ....

View : VF pages , this is UI , where end users sits and perform CRUD operation

Controller : It contains about businees logic , it all about Apex programming


lang .

View Controller model

VF Apex sObects

# Working model of MVC :

view -->> Controller-->> Model

it runs on request and reponse model


Here client Browser
browser--> request--> server
browser<---responce<-- server

Here the point is ...

When request goes to the server , the request goes in the form of data and this
data gets
processed at server side and new data gets generated and returns new Data
loaded into a page and
then that URL sent back to the client as a response

browser--> request(Data)--> server (process the old data)


browser<---responce(URL)<-- server(load the new data in the form of URL)

URL refers a page

so , here on the client side the whole page gets refreshed or reloaded on the
browser with new data .

Cricbuzz.com

1 Kl rahul 4
2 Rohit sharma 0
3
4
5
6
7
8
9
10
11
o r w r.r
1 Afridi 0.1
2
3
4
waiting time will increase response will increase
Client --> request(ols data 15 players )--> Server (15--2 players)

client<---response(URL)<--server

1) Classic Mode---MVC architecher

'Page Reference '---entire page reloaded


public pagereference insert_record(){

2) Lightning mode : SPA architecture

It is a concept which is also runs on request and response model.

but the diffrence is ,


In SPA architecture
Data goes as a request and it gets process at server side and new data gets
generated
but No URL will return , here client receives only new data.

-----------------------------------------------------------------------------------
----------

# What is browser and browser can understand ?

Browser is an Application like ms word , excel ....

It can understand only 3 things

1) HTML
2) CSS
3) Javascript

HTML : it contains description of data

CSS : it used for Decoration purpose

Javascript: It is used for processing the data .

-->> what is DATA ? types of data ?

1) static data 2)dynamic data


it is common for everyone.
it will vary from one user to another user.

for that we need to use XML


Extensible markup lang -- it is meta lang

meta lang ---it you develop a lang using another lang

XML can't understand by any browser

Parser is a s/w which converts XML to HTML


this parser s/w internally contains 'Renderer'
renderer is also s/w
this s/w dissimilates whatever comes and assembles whenever is required .

Client + Client Controller <---New Data


HTML Javascript

-----------------------------------------------------------------------------------
------------------------

# Javascript :
-----------------------

1) It is client side Scripting lang .

Programming lang
scripting lang --- 2 Types ---> client side and Server side
Markup lang javascript php
client side scripting lang are those lang which runs web browser and where as
server side
lang are runs on web server

client side scripting lang ---meant for client side validation -- signup

Server side scripting lang ---meant for Server side validation -- signIn

2) It is case sensitive Lang .

3) It is not strongly typed, because it doesn't support datatypes.

4) Javascript divided into 2 parts .

1) Internal Javascript : we need to write the javascript statment with html


tags and save the programm
with .html extention

2) External JavaScript : we need to write the javascript program seperately


and save with
.js extension and included in the javascript .

Syntax of Internal Javascript :


----------------------------------
<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">

statement 1 ;
statement 2 ;
</script>
</head>
<body>

</body>
</html>
----------------------------------------------------------------------------------

# Variable declation in javascript:

we can declare variables in javascript in 4 ways

1)var
2)let
3)nothing
4)const

syntax:- var variablename = value;


ex: var a =10;
var a= 'Raj';
var a = 98.6;
# Operators in ajavascript:
--------------------------
arithmatic operators:
+,-,*,/,%
relational operators:
>, < ,>=,<=, !=,==

assignment operators:
=
increament & decreament operators:
++, --

Tarnary operators:

--------------------------------------------------------------------------------
Input And Output Statment in javascript:

There is no input statment in javascript .

Output Statment :
------------------
document.write();
------------------

here document is a predefined object and write () is a predefine method.

Syntax 1:
document.write('message');
ex: document.write('Bikkad It ');

Syntax 2:
document.write('message'+ variablename);

ex: document.write('Bikkad It ' + result);

Syntax3:
document.write(variablename);

ex: document.write(result);

-----------------------------------------------------------------------------------
-------

Welcome message in javascript

<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">

document.write ('Welcome to Bikkad it ');

</script>
</head>
<body>
</body>
</html>

Sum of 2 numbers in javascript :

<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">
var num1 = 10;
var num2 = 30 ;
var result;
result = num1+num2;
document.write ('The Sum is ==> '+ result);

</script>
</head>
<body>

</body>
</html>

For Loop:

<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">
var i;
for(i=1;i<=10;i++){

document.write ('Welcome to Bikkad It'+'</br>');


}

</script>
</head>
<body>

</body>
</html>

-----------------------------------------------------------------------------------
------

Fuctions:
----------
Syntax of fuction :

function <fuction name>{

statement 1;

statement 2;
}

-------------------------------------------------------------------------

1) receives and returns


----------------------------
<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">
function addition(x,y){
var z;
z=x+y;
return z;

}
function fun1(){

document.write('the result is'+ addition(12,17));

</script>
</head>
<body>
<form>
<input type = "button" value = "Result" onclick="fun1()">
</form>
</body>
</html>

2) receives but doesn't return :

<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">
function addition(x,y){

var a,b;
a= x + y;
b= x - y;
document.write('the addition is'+ a '<br>' );
document.write('the sub is'+ b);
}
function fun1(){
addition(23,45);
}
</script>
</head>
<body>
<form>
<input type = "button" value = "Click" onclick="fun1()">
</form>
</body>
</html>

3) doesn't receives but returns:

<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">
function addition(){
var a=13 , b=34, c ;
c= a+b;
return c;

}
function fun1(){

document.write('the result is'+ addition());

</script>
</head>
<body>
<form>
<input type = "button" value = "Result" onclick="fun1()">
</form>
</body>
</html>

4) doesn't receives and doesn't return :


<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">

function fun1(){

document.write('Welcome to bikkad it ');

</script>
</head>
<body>
<form>
<input type = "button" value = "Result" onclick="fun1()">
</form>
</body>
</html>
-----------------------------------------------------------------------------------
------

Dialog boxex in javscript :


-----------------------------

1) Alert
2) confirm
3) prompt

prompt dialog box:


--------------------

<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">

var a = prompt ('Enter 1st No.');


var b = prompt ('Enter 2nd No.');
var c ;
c = parseInt(a) + parseInt(b) ;
document.write('the result is ==> '+ c);
</script>
</head>
<body>
<form>

</form>
</body>
</html>

Alert Dialog Box:

<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">

var a = prompt ('Enter 1st No.');


var b = prompt ('Enter 2nd No.');
var c ;
c = parseInt(a) + parseInt(b) ;
alert('the Sum of two nos ');
document.write('the result is ==> '+ c);
</script>
</head>
<body>
<form>

</form>
</body>
</html>

Confirm : before perform any operation itis asking for the confirmation.
it always returns boolean values i.e either true or false

this box contains 2 buttons


Ok cancel

true false

<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">
function fun1(){
var n = confirm('Do you want to proceed');
if (n==true)
document .write('user want to proceed ');
else
if(n==false)
document .write('user dont want to proceed ');
}

</script>
</head>
<body>
<form>
<input type = "button" value = "Result" onclick="fun1()">
</form>
</body>
</html>
-----------------------------------------------------------------------------------
--------------

# Lightning Aura :-
---------------------

1) Aura is a markup lang which contains markup lang + rich set of javascript
libraries .

2) Aura is a open source lang --open source mean every one can open and used it
freely.

3) Lightning is also markup lang -- which is extension of the aura with few more
tags and
rich set of javascript libraries all put gether

Lightning = Aura tags + Rich set of javascript libraries .

HTML--> VF pages ---> Lighting based on Aura framework -->LWC framework

purpose is same ---web page creation

but approch is diffrent, then Automatically web page behaviour will change.

TV
B&W
Colour
LCD
LED

Lighting we have a tool called "App builder " using tool we can create
lightning Applications
without writting a code .

Lightning app is the combination multiple componants .

Componant: It is an element which has its own fuctility and these componants we
can reused whenever we want .

Creating Lightning Application using Coding :

Click on setup --Developer consol --file --new --lightning Application

<aura:application >
<b> Sambhaji <br/>
Arihant <br/>
Sumedh <br/>
Vikas<br/>
Ketan </b>

</aura:application>

# Lightning Apllications contains 7 Segments :


--------------------------------------------------
1) Applicatiion:It represent name of the app and its extension is .APP
2) Controller :It represent thr client side controller logic and its extention .Js
3) Helper:This is meant for reusability purpose ,it contains supporting code and
its extention is .Js
4) Style: It is used for decorative purpose and its extension is .CSS
5) Documentaion:It contains the peoject details and description.
6) Renderer: It dissimilates the code and assembles when required .
7) SVG: It contains the display properties .

# Input componants and output componants :

<apex:inputText>
<apex:inputField>
<apex:inputTextArea>
<apex:inputSecret>
<apex:inputHidden>

<apex:outputField>
<apex:outputText>

Note : Every componant working independently

Each componant contains 3 Thigs :

1) Text 2) UI 3) Image

Text : Continuous streame of characters


UI: textboxes, radio buttons , checkboxes list boxes........
Image: pnb,bmp
Aura
Lightning
UI
Force
forceChetter

Syntax:
-----------
<namespace :tagname attribute1="value" attrubutes="values"..... >

</namespace:tagname>

ex:
<aura:componant>

</aura:componant>

# Input Tags in UI Namespace :


-----------------------------------

<ui:inputCheckbox>----It is display checkbox


<ui:inputCurrency>----It is allows only currency values
<ui:inputDate>----It is allows only date values
<ui:inputDateTime>----It is allows both date and time
<ui:inputNumber>----It is allows only number values
<ui:inputEmail>----It is allows only Email values
<ui:inputRadio>----It is display radio buttons
<ui:inputText>----It is allows only Text values
<ui:inputSecret>----It is used for password purpose
<ui:inputHidden>----It won't display textbox
<ui:inputTextArea>----it display text area box

Actions tags in UI name space :


----------------------------------------
<ui:button>
<ui:checkBoxMenuItem>
<ui:menu>
<ui:menuItem>
<ui:menuList>
<ui:menuItemSeperator>
<ui:menuTrigger>
<ui:menuTriggerLink>

-->> Create a Lightning Application with multiple Componants :


----------------------------------------------------------------

<aura:application >
<c:MyComp1></c:MyComp1><br/><br/><br/>
<c:MyComp2></c:MyComp2>
</aura:application>

<aura:component >
<b> We are from Salesforce Batch 01 Student in Bikkad It Institute.<br/>
List Of Students <br/>
Sambhaji <br/>
Arihant <br/>
Sumedh <br/>
Vikas<br/>
Ketan </b> <br/>
</aura:component>

<aura:component >
<b>We are from Salesforce Batch 02 Student in Bikkad It Institute.<br/>
List Of Students <br/>
Sandip <br/>
Gayatri <br/>
Chetana <br/>
Hari<br/>
Minal </b>
</aura:component>

-----------------------------------------------------------------------------------
-------------------

Student Enquiry Form:


------------------------

sid :<ui:inputNumber>
Sname :<ui:inputText>
qualication :<ui:inputselect>
emaild Id :<ui:inputEmail>
Mob no: <ui:inputNumber>
Gender:<ui:inputRadio>
Area of Interest: <ui:inputCheckBoc>
user Name : <ui:inputText>
Password:<ui:inputSecret>
Address : <ui:inputTextArea>

Save Cancel

<aura:application >
<c:EmquiryFormAppCmp> </c:EmquiryFormAppCmp>
</aura:application>

<aura:component >
<b> Student Id: <ui:inputNumber></ui:inputNumber><br/>
Student Name:<ui:inputText></ui:inputText><br/>
Student Qualification:<ui:inputSelect>
<ui:inputselectOption text="Under Graduate"/>
<ui:inputselectOption text="Graduate"/>
<ui:inputselectOption text="PG"/>
<ui:inputselectOption text="Ph.D"/>
</ui:inputSelect><br/>
Contact Number:<ui:inputNumber></ui:inputNumber><br/>
Email Id: <ui:inputEmail></ui:inputEmail> <br/>
Gender: Male <ui:inputRadio name="Gender"></ui:inputRadio>
Female <ui:inputRadio name="Gender"></ui:inputRadio> <br/>
Area of Interest: <br/>Watching Cricket: <ui:inputCheckBox></ui:inputCheckBox>
Readning News:<ui:inputCheckBox></ui:inputCheckBox>
Listening Music:<ui:inputCheckBox></ui:inputCheckBox>
<br/>
User Name:<ui:inputText></ui:inputText><br/>
Password:<ui:inputSecret></ui:inputSecret><br/><br/>
Address:<ui:inputTExtArea cols="30" rows="5"></ui:inputTExtArea></b><br/>
<ui:Button label="SAVE"/>
<ui:button label="CANCEL"/>
</aura:component>

Arithmatic Operation using Lightning Aura :


------------------------------------------------

App-----Cmp------Client side controller --Server side controller ---sObects


(Crud)
Cp(of Js) Js (cp of apex class) Apex Class(dp)

<aura:application >
<c:ArithmaticAppCmp> </c:ArithmaticAppCmp>
</aura:application>

<aura:component >
<aura:attribute type="Integer" name="num1" />
<aura:attribute type="Integer" name="num2" />
<aura:attribute type="Integer" name="result"/>

First Number:<ui:inputNumber value="{!v.num1}"></ui:inputNumber><br/>


Second Number:<ui:inputNumber value="{!v.num2}"></ui:inputNumber><br/>
Result:<ui:inputNumber value="{!v.result}"></ui:inputNumber><br/>

<ui:button label="ADD" press="{!c.addition}"/>


<ui:button label="SUB" press="{!c.subtraction}"/>
<ui:button label="DIV" press="{!c.divison}"/>
<ui:button label="MUL" press="{!c.multiplication}"/>
<ui:button label="REM" press="{!c.remainder}"/>
</aura:component>

({
addition : function(component) {
var n1 = component.get("v.num1") ;
var n2 = component.get("v.num2");
var sum;
sum = n1 + n2;
component.set("v.result",sum);

},
subtraction : function(component){
var n1 = component.get("v.num1");
var n2 = component.get("v.num2");
var sub;
sub = n1 - n2;
component.set("v.result",sub);
},
multiplication : function(component) {
var n1 = component.get("v.num1") ;
var n2 = component.get("v.num2");
var mul;
mul = n1 * n2;
component.set("v.result",mul);

},
divison : function(component){
var n1 = component.get("v.num1");
var n2 = component.get("v.num2");
var div;
div = n1 / n2;
component.set("v.result",div);
},
remainder : function(component){
var n1 = component.get("v.num1");
var n2 = component.get("v.num2");
var rem;
rem = n1 % n2;
component.set("v.result", rem);
}

})

-----------------------------------------------------------------------------------
------------------------

App-----Cmp------Client side controller -----Server side controller ---sObects


(Crud)
Cp(of Js) Js (cp of apex class) Apex Class(dp)

Success ...

While Connecting client side controller with Server side controller , it has
gone through many
stages/States
Start
Complete / Finish
Abort
fail
Success ....

NotePad --- Application -- many stages

minimize
maximize
close
open
restore

<aura:application >
<c:MySecondCmp></c:MySecondCmp>
</aura:application>

<aura:component controller="ServerSideClass" >


<aura:attribute type="String" name="message" />

<lightning:button label="Click on Me" onclick="{!c.fetchMessage}"/>


{!v.message}

</aura:component>

({
fetchMessage : function(component, event, helper) {
var action = component.get("c.sendMessage");
action.setCallback(this,function(response){
var state = response.getState();
if(state === "SUCCESS"){
component.set("v.message","Server Side Execution is Sucessful");
}
else{
component.set("v.message","server side execution is failed");
}
});

$A.enqueueAction(action);

}
})

public class ServerSideClass {


// member methods
@AuraEnabled
public static string sendMessage(){
return 'this is the message from servers side controller';

-----------------------------------------------------------------------------------
--------

Insert Record in Employee Sobject using Lightning Aura :


-----------------------------------------------------------------------------------
------------
<aura:application >
<c:InsertAppCmp></c:InsertAppCmp>
</aura:application>

<aura:component controller ="ServerInsert">


<aura:attribute type="String" name="message" />
<aura:attribute type="String" name="ename" />
<aura:attribute type="Integer" name="salary" />
<aura:attribute type="String" name="job" />
<aura:attribute type="Decimal" name="deptno" />

Employee Name: <lightning:input type ="String" value="{!v.ename}"/>


Employee Salary: <lightning:input type ="Integer" value="{!v.salary}"/>
Employee Job: <lightning:input type ="String" value="{!v.job}"/>
Employee Dept No: <lightning:input type ="Decimal" value="{!v.deptno}"/>

<ui:button label="SAVE" press="{!c.fetchmessage}"/>


{!v.message}

</aura:component>

({
fetchmessage : function(component, event, helper) {
var action = component.get("c.sendMessage");
action.setParams({"ename":component.get("v.ename"),
"esal":component.get("v.salary"),
"ejob":component.get("v.job"),
"edeptno":component.get("v.deptno")});
action.setCallback(this,function(response){
var state = response.getState();
if(state === "SUCCESS"){
component.set("v.message","Server Side Execution is Sucessful");
}
else{
component.set("v.message","server side execution is failed");
}
});

$A.enqueueAction(action);

}
})

public class ServerInsert {


@AuraEnabled
public static String sendMessage(String ename,Integer esal,String ejob,Decimal
edeptno){

Employee__C obj =new Employee__C ();


obj.ename__c= ename;
obj.salary__c= esal;
obj.job__c= ejob;
obj.deptno__c= edeptno;
try{
Insert obj;
return 'Employee Record Inserted Successfully';
}
catch(exception e){
return 'Record Failed ti Insert';
}
}

-----------------------------------------------------------------------------------
---------------------------------------
step1) Create a component(2nd program)
a) Declare the variables using 'attribute' tag to accept the input values at
run time.
b) setup an action UI element that connects with the action on Client side
Controller.
c) Connect the component with the sobject (standard/custom), on which we can
perform the CRUD operations,(controller ="apex class"), connection gets established
with the server controller.

step2) create an application (1st program) and include the component in that
application, here itself designing part completed.

step3) create client side controller(3rd program) , it is javascript program.

a) var action=component.get("c.serverside methd");

b) via the component, invoke the serverside method, it should go through the
component becuase server side class is referenced in the component.

c) mark the call to an action variable


Employee__c obj = new Employee();
new --- it is an operator which allocates the memory for the object
dynamically.

d) Action.setParams-- for the server method,we need to supply the parameters


through JSON code.

e) action.setCallback(this, function(response))-- state

f) respond can be the start of execution,every process will have serveral states
while
executing these are
new, running, success, error, incomplete, abort
success-- when we get the correct response from the server.
error- if the program contains any syntactical/semantical errors.
incomplete-- the server didn't not give any response.

g) based on the state value we can take appropriate steps.

step3) we need to put all stages in a queue and execute as a batch by


a method called
$A.enqueueAction();

step4) create an apex class(4th class)marked as Aura enabled method using some
annotation called '@AuraEnabled'
note : auraenabled method should be static.

== --> it directly checks the value without checking any data type.

=== --> first it check the datatype and then it checks value.
-----------------------------------------------------------------------------------
-------
-----------------------------------------------------------------------------------
----------------------------
Delete opearion:
-------------------
<aura:application >
<c:DeleteCmp></c:DeleteCmp>
</aura:application>

<aura:component controller="ServerDelete" >


<aura:attribute type="string" name="message"/>
<aura:attribute type="string" name="eid"/>

Employee Id:<lightning:input type="string" value="{!v.eid}"/> <br/>

<ui:button label="DELETE" press="{!c.fetchMessage}"/>


{!v.message}
</aura:component>

({
fetchMessage : function(component, event, helper) {
var action = component.get("c.sendMessage");
action.setParams({
"empid" : component.get("v.eid"),

});
action.setCallback(this,function(response){
var state = response.getState();
if(state === "SUCCESS"){
component.set("v.message","Server side Excution is Successful");
}
else{
component.set("v.message","server side execution is faild");
}
});
$A.enqueueAction(action);
}
})

public class ServerDelete {


// member methods
@AuraEnabled
public static string sendMessage(string empid){
Employee__C obj = new Employee__c();
obj = [select id from employee__C where name like :empid];

try{
Delete obj;
return 'record deleted successfully';
}
catch(exception e){
return 'record deletion failed';
}

}
}

-----------------------------------------------------------------------------------
------------

update the records:


----------------------
Update operation
--------------------
<aura:application >
<c:Updatecmp></c:Updatecmp>
</aura:application>

<aura:component controller = "ServerUpdate">


<aura:attribute type="string" name="message"/>
<aura:attribute type="string" name="eid"/>
<aura:attribute type="Integer" name="esal"/>

Employee Id:<lightning:input type="string" value="{!v.eid}"/> <br/>


Employee Salary:<lightning:input type="Integer" value="{!v.esal}"/> <br/>
<ui:button label="UPDATE" press="{!c.fetchMessage}"/>
{!v.message}
</aura:component>

({
fetchMessage : function(component, event, helper) {
var action = component.get("c.sendMessage");
action.setParams({
"empid" : component.get("v.eid"),
"esal" : component.get("v.esal"),
});
action.setCallback(this,function(response){
var state = response.getState();
if(state === "SUCCESS"){
component.set("v.message","Update is Successful");
}
else{
component.set("v.message","server side execution is failed");
}
});
$A.enqueueAction(action);
}
})

public class ServerUpdate {


// member methods
@AuraEnabled
public static string sendMessage(string empid,Integer esal){

Employee__C obj = new Employee__c();


obj = [select id,Salary__c from Employee__C where name like :empid];

obj.Salary__c = esal;
try{
Update obj;
return 'record Update successfully';
}
catch(exception e){
return 'record Update failed';
}

}
-----------------------------------------------------------------------------------
--------------------

LWC (Lightning Web Component)

You might also like