Professional Documents
Culture Documents
Salesforce Notes - 01
Salesforce Notes - 01
-------------
company
1999- marc benioff ---USA---CEO
Salesforce CRM-
SDLC
1)Requirement
2)Design
3)Development
4)Testing
5)Deployment
BA---
Enterprice App--
Apex---It it a one type of Backend Developement lang. 90% same as java lang .
Google--Gmail
Microsoft--windows, ms-office
Salesforce --CRM,Salesforce
IBM---db2
SAP--ABAP
Oracle--Oracle database
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.
Difficulties------s/w App
upgradation
maintanance
installation....everthing will be taking care of clients and Development
companies---set up Cost
Laptop--50k
printer--20k
Stationary--500rs
Internet connection---1000rs/month
70 to 75 k ---per month
30min ---10rs
stationary --10 rs
monthly only 6k
--------------------------------------------------------------------------
Vendor company provides 3 Types of Services :
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,
example:Salesforce----force.com/lightning
Developer develope Apps As per client requirements
RAD--Rapid App Developement (quick/fast App Developement)
3) SaaS:(Software/App As aService)
Goals of CRM:
maintained the Existing Customer and Grab the new customer into the Business.
Quality product
Quality Service
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
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:
----------------------
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
3)AppExchange.com:-
-------------------
It is a place wherev Developers can SELL the Applications and where as
clients will BUY the Applications
Thakrey----CM
Shinde-----CM
Product----IPhone 14
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 ----
4 / 5 years .......
Versons Of Salesforce :
-----------------------------
Every year salesforce releases 3 types of versions based on seasons.
1) Winter version
2) Summer Version
3) Spring Version
Editions Of Salesforce:
--------------------------
Plan---editions
8805589715----prepaid ---Airtel---2010
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 :
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.
c)full Copy Sandbox:It contains the replica (Duplicate copy) of the original
application
It is used for Testing purpose.
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.
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 :
-------------------
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
Configuration Part:-
w.r.t Salesforce
App: App can be define as group of tabs which provides some fuctinality.
w.r.t.Salesforce
Using Tab we can Access the sObject.
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.
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)
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:Bank of India
Tab:Accounts
sObject: Account
field: Sr.no Name Contact Address Pincode AdharNo
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.
Arti-----HR Manager
report -------- see the employee details who are working under deptno 90
What is relationship:
------------------------ Data store physically in one sObject , if you want create
a link and access the information in another sObject.
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
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.
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.
father mother
child -------junction object
Junction object -----if any sobject has 2 parents then that child sobject can be
called as junction object .
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)
5) rollup summary:
-----------------
In this relationship,Parent sobject can get summarized information
about the child sobject.
sum()
max()
min().......workds on fields in the sobject
count().......works on record in the sobject
-----------------------------------------------------------------------
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.
a) size/width checking
b) data type checking / Invalid data
c) uniqueness checking
d) mandatory fields checking
1) Employee
salary <25000
States
cities
A.P
Vij
Viz
kadapa
Maharashtra
mumbai
nagpur
pune
Nashik
Page Layout :
-------------
HDFC ---customer ---Application Form
Rahul ----Manager ----Screen
Sambhaji ----Cashier----Screen
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
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
-----------------------------------------------------------------------------------
# 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
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
D/B------Oracle ---C++
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
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
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: =
a=2,b,c
b= 2 * (a++);---Post increment ---2+1=3
c= 2 * (++a);---Pre increment ---1+3=4
b= 4 c=8
a=2,b,c
b= 2 * (a--);---Post Decrement --2-1=1
c= 2 * (--a);---Pre Decrement --1-1=0
b= 4 c=0
8) Arithmatic Assignment :-
+=
-=
/=
*=
--------------------------------------------------------------------------------
System.debug (); ----this is not a output statment , but this statement will
write the output in log file.
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);
eg: Integer x;
Syntax:
Comments in APEX:
--------------------
2) Multiline comment : /* */
Examples : -
2) Iterative Statements :- For Loop, for each loop , while loop , do-while loop
,
-----------------------------------------------------------------------------------
-
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
----
----
----
----------
----------
----------
------
------
------
------
-----------
-----------
-----------
-----
-----
-----
-----------
-----------
----------
C ---
main()
----
----
----
----
Addition (); jump
------
----
----
-----
Addithin();
-----
-----
------
-------
}
Addition (){
Adv:
decrease the redundency of instructions
time saving
less memory occupation
performance improve
within time
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
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;
}
void fun(){
-----------------------------------------------------------------------------------
-------
1) Encapsulation
2) Abstraction
3) polymorphisum
4) Inheritance
1)Encapsulation :-
a=10;
a=100;
a=1000;
Arrays: It is a collation of values which are all belongs to same data types .
1000 variables
-----------------------------------------------------------------------------------
Struct
union
typedef
enum
Struct student {
Integer srno , fees;
String sname ;
date dob;
decimal am ;-----data members
}
main (){
v.srno ;
v.sname ;
v.dob ;
Data :-
if we want to perform the operation on data , what we need to do ?
Encapsulation:-
Wrapping of data and related fuctionaliies are together as a single unit.
2) Interface ----
Syntax of Class :
class <classname>{
data members
members methods
totalmarks (){
}
Avgmarks (){
Abstraction :-
-------------
Showing the set of services and hiding the internal data .
4 Keywords / Modifiers :-
Syntax Of Abstraction:
@isTest : This annotation conveys to the server saying that it is not businees
-----------------------------------------------------------------------------------
---------
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 {
Multiple Scenarios
//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 {
Constructor :-
-------------------
2) should not write any return type including void before constructor .
4) Constructor method will call only 1 time that is at the time object creation
only.
//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 {
obj.myMethod(200,300);
obj.showMethod();
obj.addition();
obj.myMethod(2000,3000);
obj.showMethod();
obj.addition();
//Member Methods
//1.create
public FirstClass(){
num1 = 0;
num2 = 0;
}
//2.Input
public void myMethod(Integer num1 , Integer num2){
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 {
-----------------------------------------------------------------------------------
-------------------------
1 ) Can we write public , static , testmethod all these 3 keywords in any order
or not ?
2) Can we write more than one testmethod in a single test class or not ?
public FirstClass(){
num1 = 0;
num2 = 0;
this.num2=num2;//0 = 45
}
@isTest
public class FirstClassTest {
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.
Que:- Write an Apex program to input student number , name ,3 subject marks ,
calculate total marks and Avg marks .
// 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.
Non-Veg Hotel
TV----match ----Static variable
60k
}
/* 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);
}
@isTest
public class BankAccountClassTest {
-----------------------------------------------------------------------------------
------
Polymorphysim:-
------------------------
poly---many
morph---forms
1) Constructor overloading :
2) Operator Overloading :
3) method Overloading :
@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 :-
-------------------
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
Exception : No output
----
----
try {
catch {
Massage (Igatpuri)---
10k ---15k
@isTest
public class ExceptionClass {
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 .
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.assertEquals(num2, 0, 'msg');
}
}
-----------------------------------------------------------------------------------
-----------
@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 .
Synchronous Execution :
@isTest
public class FutureClassTest {
public static testmethod void main(){
syntax :
select f1,f2.....fn from <sobject name>
eg:
select name,ename__c,salary__c,job__c,deptno__c from employee__c
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
q1) display the employees details who are working under deptno 10 and 20
q2) display the employees details whose salary is between 10k to 15k
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'
q6) display the employees details whose name start with 's'
q7) display the employees details whose name or job contains only 5 letters.
----------------------------------------------------------------------------------
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>
-----------------------------------------------------------------------------------
-----
# 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
2). count (column name):this fuction counts the number of records in the sobject
including duplicates but excluding null.
-----------------------------------------------------------------------------------
-----------
# Group by Clause:
---------------
this clause is used tom divide records based category.
# 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
Offset:
2)We can query only on fields whose data type is text,phone and Email.
# 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>();
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);
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:
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(){
Update obj;
system.debug(obj);
}
}
In Anonymous window :
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 :
-----------------------------------------------------------------------------------
------------------
# 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.
<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>
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:
<apex:page >
<h1>Congratulations</h1><br/>
Sambhaji<br/>
Umesh<br/>
Shreyash<br/>
Arti<br/>
Unnati
</apex:page>
1) sideBar
2) showHeader
3) action
4) tabStyle
5) renderer
6) renderedAs
7) recordSetVar
8) controller
9) Standardcontroller
10) Extention
<h1>Congratulations</h1><br/>
Sambhaji<br/>
Umesh<br/>
Shreyash<br/>
Arti<br/>
Unnati
</apex:page>
<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>
<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:
------------
# 1) Statndard Controller :
------------------------
1) Standard controller gives standard functionalities such as
Insert, Update , Delete , select (CRUD Operation)
4) But the limitation of standard controller is Using this we can perform only
these 4 Operations
Save cancel-------
ex:
<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.
-----------------------------------------------------------------------------------
----------
<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>
------
// data methods
public PageReference remainder() {
result = math.mod(num1,num2);
return null;
}
<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>
-----------------------------------------------------------------------------------
-----------
<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: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>
eid= obj.name;
empname= obj.ename__c;
empSalary= obj.salary__c;
empJob = obj.job__c;
empDno = obj.deptno__c;
return null;
}
<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>
The comman point between the standard and custom controller is at a time we can
fetch only 1 record .
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.
1) Data List:
</apex:pageBlock>
</apex:form>
</apex:page>
2) Data Table :
</apex:dataTable>
</apex:pageBlock>
3) PageBlock Table :
</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>
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}"/>
<apex:outputText
value="{!er.Ename__c}"/>  
;
<apex:outputText
value="{!er.Salary__c}"/> &nbs
p;
<apex:outputText
value="{!er.Job__c}"/>
<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 :
-----------------------------------------------------------------------------------
---------------------------------------
class MyClass1 {
}
}
}
}
}
the above program shows the error
Inner Types are not allow to have inner types .
}
public class InnerMostClass2{
}
}
//businees Logic
public class MyClass1 {
public class InnnerClass1{
}
public class InnerMostClass2{
}
}
@isTest
public class MyClass1Test {
# Interface:
-----------
O.S : it is a s/w which acts like an interface b/w USER and CPU
Application(Apex)----------------Interface----------------------ARE (Apex
runtime Engine)
In Apex , We no need to create any Interface , Here evertthing is predefine.
Interface <interfacename>{
method prototype;
}
data members
+
member methods
+
method prototypes
}
}
Note: We can write an interface within class but we can't write class within
interface
}
Note : The abpve program shows error message :
Static can only be used on methods of top level type
# Schedule Apex :
------------------
Event: Some action / operation
2) Time Based Events: some action are perform Automatically based on time without
user interaction.
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:
--------------------------
5 floors
5 flats
25 families --Comman place
25 ---car---
Lakhs --- every month 1 govement of india , create there salaries in there
accounts
70k pension
50k + 70k = 120k
100 ---Student
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
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".
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
In the above program , All three methods prints only the name "Sambhaji"
because By default Batchapex is "STATELESS".
To execute program :
BeyondGL obj = new BeyondGL();
database.executeBatch(obj);
mail.setToAddresses(toAddress);
mail.setSubject('Batch Apex Job Completed');
mail.setPlainTextBody('Batch Apex Job Accomplished Successfully');
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
}
}
-----------------------------------------------------------------------------------
-----------------
# Triggers :
------------
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.
befor--- Validation
After ---- Automation
2) Trigger Always fires against DML operations only, trigger never fires against
Select operation .
trigger.tcv
EX:
trigger.old
trigger.new
trigger.isBefore
statement 1;
statement 2;
-----------------------------------------------------------------------------------
------------
3) Write a trigger program to stop Insert and update operation on Course sobject if
fees is less than 500.
-----------------------------------------------------------------------------------
---------------------------
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)
Phone
Account name
-----------------------------------------------------------------------------------
--------------------
1) Integration :
----------------
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 .
KFC
mkt -- Adv
sales --5 Lakh
HR --Employee
finance-- Monetory trasaction
3) Patterns Of Integration :
-------------------------
a) Tightly Coupling :
HR(SAP-workbook)
b) loosely Coupling :
HR(SAP-workbook)
sales(salesforce- crm)
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 :
-------------------------------
Parts Of functios:
-----------------------
main (){
--
--
---
---
totalmarks();// calling point
--
--
--
definition point
totalmarks(){
--
---
--
---
}
C Lang --- calling point and sub program both residing in the same program .
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 :
----------
public totalmarks(){
app2
(SAP/ABAP)
---------------------
calling
point
SOAPClass(dp) MySOAPClass(cp)
-----------------------------------------------------------------------------------
----------------------
CRUD Operation :
------------------
1)Insert operation into in Employee sobject using SOAP API:
-------------------------------------------------------------
for(Employee__C er : obj){
System.debug(er);
}
Delete obj;
}
}
Undelete obj;
}
}
-----------------------------------------------------------------------------------
-------------------------------
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.
Definition point
-------------------------------------
class <class name> {
calling point
-----------------------
3rd
party App called Workbench
json
code--Javascript object notation
-----------------------------------------------------------------------------------
-----------------------------
@RestResource(URLMapping='/RestPage')
global class RestClass {
@HttpPost
global static void Insert_record( String ename,Double sal, Integer dno , String
job ){
Syntax of Abstraction :
eg:
Note: At the class level , Data members should always private abstraction and
member methods are always
public abstraction .
-----------------------------------------------------------------------------------
----------
---->It contains object definition ,through which we can execute the business
class .
To distinguish between businees class and test class is , every test class start
with an
annotation is "@isTest"
Abtraction / Modifires :
Private
Public
Protected
Global
Acccessibility Level
# Inheritance :
---------------
poly ---many
`method name same but method Arguments/parameters are different in a same class .
Virtual keyword
override keyword
// 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 :-
system.debug('No== '+no);
Instance Block
{
// Code
}
Static Block
static {
// code
}
modifire <classname>(){
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 {
{
System.debug('Instance Block ');
MAX_SPEED =70;
}
static {
public Car(){
system.debug('Max Speed '+ MAX_SPEED);
}
-----------------------------------------------------------------------------------
-------------------------------------------------
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:
Ex:
void show();
void wish();
string display();
system.debug('wish method');
}
return result;
Super Keyword :
Assignment :
Wrapper Class:
Diff b/w Abstract class and Interface
This keyword
-----------------------------------------------------------------------------------
------------------------------
Gols Of CRM : Retain the existing customer and grab the new customer in the
businees.
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.
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
15) Activities
16) Task
17) event
18) Calendar
ie. TV adds , Papare ads , Hoardings , radio , mounth talk , social media ....
Scenario:
---------
you want to give some gift to your employees who performs well in the last year .
1000---employees
This sobject stores the information about the lead , using this information we
can reach the lead again and again
3) Account : it is nothing but the company/ organisation from where our leads are
originate .
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-->
12) Assets:
house ---Rent ---u will get rent income
"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 .
14) Solution :
-----------------------------------------------------------------------------------
------------
Home Tab
Tab sobject
Accounts Account
Leads lead
contacts contact
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'
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
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 .
--> 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:
---> 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 .
1) Insert:
Import : Moving the data from external system to salesforce sobject.
Employeee
---> 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.
Insert
update
upsert
export
exportAll
delete
Hard Delete
ExportAll : it will export the records from sobject and recycle bin records as well
.
-----------------------------------------------------------------------------------
------------------------------------
i want to trasper some amount from my account to another account --- OTP to my
registered mobile.
1) Workflows
2) Process builder
3) Flow Builder
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 .
10 Pm
1) Email Alerts
2) Assign Task
3) Field Update
4) outbound Message
Email Templetes :
2 ) When to Use ?
3) How to create ?
4) Limitations of workflows ?
2) Field Update :
scenario:
change the employee job as Analyst if job is Manager
-------------------------------------
-----------------------------------------------------------------------------------
-------------------
2) Process builder :-
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 :
Opportunity Account
stage = close won Insert
4) Post to chatter:
when we inserted new record into account sobject ,if type =customer-direct then
sobject = Account
condition: type = customer-direct
5) Approval Process :
Rule : if any total bill is more that 1 lakh then he is eligible for discount
-----------------------------------------------------------------------------------
--------------------------
Report:
------
Report is formal documents written for a specific audience to meet specific need.
-----------------------------------------------------------------------------------
-----------------------
# Dashboards: It is place where we store / place more than one reports.
OR
Dashboard is main canvas where we can store collection of Reports.
Ex:
CEO of the company , I just want to know sales Report of last year quarterly
wise .
-----------------------------------------------------------------------------------
-----------------------
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
System Admionistrator:
# What is profile, Types of Profile and How to ctreate a profile , Assign the
profile to specific user :
CRUD operaion
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
Employee__C
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)
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:
# Manual Sharing :
# Role:
-------
job/ Designation
Trainer 1 --Arihant
Trainer 2---Pooja
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:
------------------
# Public Groups:
---------------
--> public group consist of set of users/ Roles/ Roles & Sub Ordinates / Public
Groups .
# Queues:
--------
---> Queues nothing but a location which holds a collection of Records for some
time are in waiting state.
2) Queues Members
-----------------------------------------------------------------------------------
----------------------------
# Flow Builder:-
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:
-----------------------------------------------------------------------------------
-
# Lightning :- Aura and LWC Componants
HTMl , JS , CSS
View : VF pages , this is UI , where end users sits and perform CRUD operation
VF Apex sObects
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
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) HTML
2) CSS
3) Javascript
-----------------------------------------------------------------------------------
------------------------
# Javascript :
-----------------------
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
statement 1 ;
statement 2 ;
</script>
</head>
<body>
</body>
</html>
----------------------------------------------------------------------------------
1)var
2)let
3)nothing
4)const
assignment operators:
=
increament & decreament operators:
++, --
Tarnary operators:
--------------------------------------------------------------------------------
Input And Output Statment in javascript:
Output Statment :
------------------
document.write();
------------------
Syntax 1:
document.write('message');
ex: document.write('Bikkad It ');
Syntax 2:
document.write('message'+ variablename);
Syntax3:
document.write(variablename);
ex: document.write(result);
-----------------------------------------------------------------------------------
-------
<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">
</script>
</head>
<body>
</body>
</html>
<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++){
</script>
</head>
<body>
</body>
</html>
-----------------------------------------------------------------------------------
------
Fuctions:
----------
Syntax of fuction :
statement 1;
statement 2;
}
-------------------------------------------------------------------------
}
function fun1(){
</script>
</head>
<body>
<form>
<input type = "button" value = "Result" onclick="fun1()">
</form>
</body>
</html>
<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>
<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(){
</script>
</head>
<body>
<form>
<input type = "button" value = "Result" onclick="fun1()">
</form>
</body>
</html>
function fun1(){
</script>
</head>
<body>
<form>
<input type = "button" value = "Result" onclick="fun1()">
</form>
</body>
</html>
-----------------------------------------------------------------------------------
------
1) Alert
2) confirm
3) prompt
<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">
</form>
</body>
</html>
<html>
<title>
title of the program
</title>
<head>
<script langauge = "javascript">
</form>
</body>
</html>
Confirm : before perform any operation itis asking for the confirmation.
it always returns boolean values i.e either true or false
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
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 .
Componant: It is an element which has its own fuctility and these componants we
can reused whenever we want .
<aura:application >
<b> Sambhaji <br/>
Arihant <br/>
Sumedh <br/>
Vikas<br/>
Ketan </b>
</aura:application>
<apex:inputText>
<apex:inputField>
<apex:inputTextArea>
<apex:inputSecret>
<apex:inputHidden>
<apex:outputField>
<apex:outputText>
1) Text 2) UI 3) Image
Syntax:
-----------
<namespace :tagname attribute1="value" attrubutes="values"..... >
</namespace:tagname>
ex:
<aura:componant>
</aura:componant>
<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>
-----------------------------------------------------------------------------------
-------------------
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>
<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"/>
({
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);
}
})
-----------------------------------------------------------------------------------
------------------------
Success ...
While Connecting client side controller with Server side controller , it has
gone through many
stages/States
Start
Complete / Finish
Abort
fail
Success ....
minimize
maximize
close
open
restore
<aura:application >
<c:MySecondCmp></c:MySecondCmp>
</aura:application>
</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);
}
})
-----------------------------------------------------------------------------------
--------
</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);
}
})
-----------------------------------------------------------------------------------
---------------------------------------
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.
b) via the component, invoke the serverside method, it should go through the
component becuase server side class is referenced in the component.
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.
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>
({
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);
}
})
try{
Delete obj;
return 'record deleted successfully';
}
catch(exception e){
return 'record deletion failed';
}
}
}
-----------------------------------------------------------------------------------
------------
({
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);
}
})
obj.Salary__c = esal;
try{
Update obj;
return 'record Update successfully';
}
catch(exception e){
return 'record Update failed';
}
}
-----------------------------------------------------------------------------------
--------------------