From Hariharan B To All Attendees: 12:28 PM

You might also like

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

support.ignite@tcs.

com

Hariharan - hariharan19105@gmail.com

from Hariharan B to All Attendees: 12:28 PM


melekarshraddha28@gmail.com

preethamkumari391@gmail.com

adityamondal17@gmail.com

preethamkumari391@gmail.com

Batch apex is a asynchronous process . Whenever the


resources are available then only the tab will execute in
BatchApex we implement database.batchable interface.
start();
execute();
final();

Batch apex is use to run large job that would exceed


normal processing limit.using batch apex you can
process records asynchronously in batches within
platform limit.

It is a process or function that executes a task without


the user having to wait for the task to complete.it is use
to run the task on separate thread.
_____________________All Standard Object Querys
With Different Types and
Conditions____________________________________
_____________________________________________
______
1) ++++++++++++++++++++++++++++++ All Query On
Account Object+++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++

1) Parent To Child Query :- *Parent - Accounts and


*Child- Contacts (Lookup Relationship in Between
Accounts Lookup contacts)
Query :- Select Id, Name ,(Select Id, Name From
Contacts) From Account
_____________________________________________
_____________________________________________
____________________

2)Child To Parent Query :- *Child - Contacts , *Parent -


Accounts ( Accounts Lookup Contacts)
Query :- Select Id, Name , Account.Id , Account.Name
From Contact
_____________________________________________
_____________________________________________
_______________
+3) Where Clause Query On Standard Object:-
1)Standard Object
1)Account Object :-
1)Select Id, Name From Account Where Phone = '(915)
859-3880' , Rating = 'Hot' // both of not declare but
why aked any one it is giving error but why asked any
one to this anser
2)Select Id, Name From Account Where Rating = 'Hot'
3)Select Id, Name From Account Where Phone = '(915)
859-3880'

_____________________________________________
_____________________________________________
______________________________
4) Group By - Having Query On Standard Objects :-
1) Account Object :-
1) Select Count(Id) , Name From Account group by
Name having Count(Id)=1
2)Select Count(Id), Name From Account group by
Name having Name ='Rohit'

_____________________________________________
_____________________________________________
________________________
5) Limit Quey On standard Object :-
1)Select Id, Name From Account Where Phone = '(915)
859-3880' limit 1

_____________________________________________
_____________________________________________
____________
6)Offset Query On Standard Object :-
1)Select Id, Name From Account Where Phone = '(915)
859-3880' offset 1

_____________________________________________
_____________________________________________
_______________
7)Limit with Offset on Standard Object :-
1)Select Id, Name From Account Where Phone = '(915)
859-3880' limit 1 offset 1

_____________________________________________
_____________________________________________
_____________________________________________
__
8)ORDER BY Quey on Standard Object :-
a)Parent to child query way :-
1)Select Id, Name ,(Select Id, Name From Contacts)
From Account ORDER BY Name Asc // Account to
Contact not possoible gives error query
2)Select Id, Name ,(Select Id, Name From Contacts)
From Account ORDER BY Id ASC
3)Select Id, Name ,(Select Id, Name From Contacts)
From Account limit 1 offset 1 ORDER BY Name DESC

b)Child to parent query way :-


4)Select Id, Name , Account.Id , Account.Name From
Contact ORDER BY Name DESC // Account to
Contact not possoible gives error query

c) Normal way
5)Select Id, Name From Contact ORDER BY Id Desc
6)Select Id, Name From Contact ORDER BY Name Asc
7)Select Id, Name From Account ORDER BY Id Desc
8)Select Id, Name From Account ORDER BY Name Asc

==========================================
==========================================
==========================================
==========================================
================
++++++++++++++++++++++++++++++++++++++++++
+++++++++++++ 2) All Query on Opportunitie object ++
++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++

1)Parent To Child Query :- *Parent - Accounts and


*Child- Opportunities (Lookup Relationship in Between:-
(Account Lookup Opportunities/Opportunity )
Query :- Select Id, Name ,(Select Id, Name From
Opportunities) From Account

_____________________________________________
_____________________________________________
_________________
2)Child To Parent Query :- *Child - Opportunitie , *Parent
- Accounts ( Accounts Lookup Opportunitie/Opportunity )
Query :- Select Id, Name , Account.Id , Account.Name
From Opportunity

_____________________________________________
_____________________________________________
_________
3) Where Clause Query On Standard Object:-
1)Standard Object
1)Opportunities Object :-
1)Select Id, Name From Opportunity Where
StageName = 'Qualification'
2)Select Id, Name From Opportunity Where Type =
'Existing Customer - Upgrade'
_____________________________________________
_____________________________________________
______________________________
4) Group By - Having Query On Standard Objects :-
1) Opportunitie Object :-
1) Select Count(Id) , Name From Opportunity group by
Name having Count(Id)=1
2)Select Count(Id), Name From Opportunity group by
Name having Name ='Megha'
_____________________________________________
_____________________________________________
________________________
5) Limit Quey On standard Object :-
1)Select Id, Name From Opprtunity Where StageName
= 'Qalification' limit 1
_____________________________________________
_____________________________________________
____________
6)Offset Query On Standard Object :-
1)Select Id, Name From Opportuniy Where StageName
= 'Qalification' offset 1

_____________________________________________
_____________________________________________
_______________
7)Limit with Offset on Standard Object :-
1)Select Id, Name From Opportunity Where
StageName = 'Qalification' limit 1 offset 1

_____________________________________________
_____________________________________________
_____________________________________________
__
8)ORDER BY Quey on Standard Object :-
1)Select Id, Name From Opportunity ORDER BY Name
Asc
2)Select Id, Name From Opportunity ORDER BY Id Asc

a)Query of Parent to child on apply:-


1)Select Id, Name ,(Select Id, Name From
Opportunities) From Account ORDER BY Name DESC
2)Select Id, Name ,(Select Id, Name From
Opportunities) From Account ORDER BY Id DESC

b)Query Of Child to Parent Apply on:-


3)Select Id, Name , Account.Id , Account.Name From
Opportunity ORDER BY Id DESC
4)Select Id, Name , Account.Id , Account.Name From
Opportunity ORDER BY Name DESC

==========================================
==========================================
==========================================
============================

++++++++++++++++++++++++++++++++++++++++++
+++++++++++++3) All Query on Opportunity object +++
++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++

1) Parent To Child Query :- *Parent - Accounts and


*Child- Opportunities (Lookup Relationship in Between:-
(Contact Lookup Opprtunities/Opportunity))
Query :- Select Id, Name ,(Select Id, Name From
Opportunities) From Contact
_____________________________________________
_____________________________________________
_________________
2)Child To Parent Query :- *Child - Opportunitie , *Parent
- Accounts ( Accounts Lookup Opportunitie and Contact
Lookup Opportunities)
Query :- Select Id, Name , Contact.Id , Contact.Name
From Opportunity //this relation not exist thats why find
it ,it gives error that relation not work in that query

_____________________________________________
_____________________________________________
_________
3) Where Clause Query On Standard Object:-
1)Standard Object
1)Opportunities Object :-
1)Select Id, Name From Opportunity Where
StageName = 'Qalification'

_____________________________________________
_____________________________________________
______________________________
4) Group By - Having Query On Standard Objects :-
1) Opportunitie Object :-
1) Select Count(Id) , Name From Opportunity group by
Name having Count(Id)=1
2)Select Count(Id), Name From Opportunity group by
Name having Name ='Megha'

_____________________________________________
_____________________________________________
________________________
5) Limit Quey On standard Object :-
1)Select Id, Name From Opprtunity Where
StageName = 'Qalification' limit 1

_____________________________________________
_____________________________________________
____________
6)Offset Query On Standard Object :-
1)Select Id, Name From Opportunity Where
StageName = 'Qalification' offset 1

_____________________________________________
_____________________________________________
_______________
7)Limit with Offset on Standard Object :-
1)Select Id, Name From Opportunity Where
StageName = 'Qalification' limit 1 offset 1

_____________________________________________
_____________________________________________
_____________________________________________
__
8)ORDER BY Quey on Standard Object :-
a)Query of Parent to child on apply:-
1)Select Id, Name ,(Select Id, Name From
Opportunities) From Contact ORDER BY Name Asc
2)Select Id, Name ,(Select Id, Name From
Opportunities) From Contact ORDER BY Id Asc

a)Query of Parent to child on apply:-(This Relation not


work)
3)Select Id, Name , Contact.Id , Contact.Name From
Opportunity ORDER BY Id DESC //error
4)Select Id, Name , Contact.Id , Contact.Name From
Opportunity ORDER BY Name DESC //error

==========================================
==========================================
==========================================
====================================

++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++4) All Query On Assests Object
++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++

1)1) Parent To Child Query :- *Parent - Accounts and


*Child- Assets (Lookup Relationship in Between Assets
Lookup Account)
Query :- Select Id, Name ,(Select Id, Name From
Assets) From Account
_____________________________________________
_____________________________________________
____________________

2)Child To Parent Query :- *Child - Asset , *Parent -


Accounts ( Accounts Lookup Contacts)
Query :- Select Id, Name , Account.Id , Account.Name
From Asset
_____________________________________________
_____________________________________________
_______________
3) Where Clause Query On Standard Object:-
1)Standard Object
1)Asset Object :-
1)Select Id, Name From Asset Where Status =
'Installed'
2)Select Id, Name From Asset Where PurchaseDate =
'8/10/2021' // it is giving error but why asked any one
to this anser beauseoif date how to write

_____________________________________________
_____________________________________________
______________________________
4) Group By - Having Query On Standard Objects :-
1) Asset Object :-
1) Select Count(Id) , Name From Asset group by Name
having Count(Id)=1
2)Select Count(Id), Name From Asset group by Name
having Name ='Sauravi Khamankar'

_____________________________________________
_____________________________________________
________________________
5) Limit Quey On standard Object :-
1)Select Id, Name From Asset Where Status =
'Installed' limit 1

_____________________________________________
_____________________________________________
____________
6)Offset Query On Standard Object :-
1)Select Id, Name , Account.Id , Account.Name From
Asset offset 2

_____________________________________________
_____________________________________________
_______________
7)Limit with Offset on Standard Object :-
1)Select Id, Name ,(Select Id, Name From Assets) From
Account limit 1 offset 10

_____________________________________________
_____________________________________________
_____________________________________________
__
8)ORDER BY Quey on Standard Object :-
b)Normal way:-
1)Select Id, Name From Asset ORDER BY Name Asc
3)Select Id, Name From Asset ORDER BY Id Asc

c)Parent to child query way :-


1)Select Id, Name ,(Select Id, Name From Assets) From
Account ORDER BY Name Asc
2)Select Id, Name ,(Select Id, Name From Assets) From
Account ORDER BY Id Asc

a)Child to parent quer way:-


2)Select Id , Name , Account.Id , Account.Name From
Asset ORDER BY Name Desc
3)Select Id , Name , Account.Id , Account.Name From
Asset ORDER BY Name Desc

==========================================
==========================================
==========================================
====================
++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++5) All Query On Assests Object
++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++

1)1) Parent To Child Query :- *Parent - Accounts and


*Child- Assets (Lookup Relationship in Between Assets
Lookup contact)
Query :- Select Id, Name ,(Select Id, Name From
Assets) From Contact
_____________________________________________
_____________________________________________
____________________

2)Child To Parent Query :- *Child - Asset , *Parent -


Accounts ( Accounts Lookup Contacts)
Query :- Select Id, Name , Contact.Id , Contact.Name
From Asset
_____________________________________________
_____________________________________________
_______________
3) Where Clause Query On Standard Object:-
1)Standard Object
1)Asset Object :-
1)Select Id, Name From Asset Where Status =
'Installed'
2)Select Id, Name From Asset Where PurchaseDate =
'8/10/2021' // it is giving error but why asked any one
to this anser beauseoif date how to write

_____________________________________________
_____________________________________________
______________________________
4) Group By - Having Query On Standard Objects :-
1) Asset Object :-
1) Select Count(Id) , Name From Asset group by Name
having Count(Id)=1
2)Select Count(Id), Name From Asset group by Name
having Name ='Sauravi Khamankar'

++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++
Lead Standard Object

3) Select Count(Id), LeadSource From Lead group by


LeadSource having LeadSource = 'Web'

_____________________________________________
_____________________________________________
________________________
5) Limit Quey On standard Object :-
1)Select Id, Name From Asset Where Status =
'Installed' limit 1

_____________________________________________
_____________________________________________
____________
6)Offset Query On Standard Object :-
1)Select Id, Name , Account.Id , Account.Name From
Asset offset 2

_____________________________________________
_____________________________________________
_______________
7)Limit with Offset on Standard Object :-
1)Select Id, Name ,(Select Id, Name From Assets) From
Account limit 1 offset 10

_____________________________________________
_____________________________________________
_____________________________________________
__
8)ORDER BY Quey on Standard Object :-
c)Parent to child query way :-
1)Select Id, Name ,(Select Id, Name From Assets) From
Contact ORDER BY Name Asc
2)Select Id, Name ,(Select Id, Name From Assets) From
Contact ORDER BY Id Asc

a)Child to parent quer way:-


2)Select Id , Name , Contact.Id , Contact.Name From
Asset ORDER BY Name Desc
3)Select Id , Name , Contact.Id , Contact.Name From
Asset ORDER BY Id Desc

==========================================
==========================================
==========================================
==============================

++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++6)All Custom Object Query All
Types Condition is Satisfied+++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++

1)1) Parent To Child Query :- *Parent - Police and


*Child- FIRs (Lookup Relationship in Between FIRs
Lookup Police)
Query :- Select Id ,Name, Phone__c , Gender__c ,
(Select Id, Name , Address_Of_Person__c, Age__c,
DateandTime_of_FIR_Write__c, Email__c
,FIR_Reason__c ,
Indetity_Proof_of_Person__c ,
Name_of_Person__c , Police_Name__c , Phone__c
From FIRs__r) From Police__c
_____________________________________________
_____________________________________________
____________________

2)Child To Parent Query :- *Child - FIR__c , *Parent -


Police__c ( Accounts Lookup Contacts)
Query :- Select Id , Name, Police__c.Phone__c ,
Police__c.Id ,Police__c.Name From FIR__c //
error give
_____________________________________________
_____________________________________________
_______________
3) Where Clause Query On Standard Object:-
1)Standard Object
1) FIR__c and Police__c Object :-
1)Select Id, Name From FIR__c Where Age__c =
'Female'
2)Select Id, Name ,Address_Of_Person__c , Age__c ,
DateandTime_of_FIR_Write__c , Email__c
,FIR_Reason__c ,
Indetity_Proof_of_Person__c ,Name_of_Person__c
,Phone__c From FIR__c Where Age__c = 'Female'
3)Select Id, Name From Police__c Where Gender__c =
'Male'
4)Select Id, Name , Gender__c , Phone__c From
Police__c Where Gender__c = 'Male'
_____________________________________________
_____________________________________________
______________________________
4) Group By - Having Query On Standard Objects :-
1) FIR__C AND Police__c Object :-
1) Select Count(Id) , Name From FIR__c group by
Name having Count(Id)=1 //error
2)Select Count(Id), Name From FIR__c group by Name
having Name ='Saurav Jagtap' //error
3)Select Count(Id), Name From Police__c group by
Name having Name ='Saurav Jagtap'
4)Select Count(Id) , Name From Police__c group by
Name having Count(Id)=1
_____________________________________________
_____________________________________________
________________________
5) Limit Quey On Custom Object :-
1)Select Id, Name From FIR__c Where
FIR_Reason__c = 'Murder' limit 1

_____________________________________________
_____________________________________________
____________
6)Offset Query On Custom Object :-
1)Select Id, Name , Police__c.Id , Police__c.Name From
FIR__c offset 2 //error

_____________________________________________
_____________________________________________
_______________
7)Limit with Offset on Standard Object :-
1)Select Id, Name ,(Select Id, Name From FIRs__r)
From Police__c limit 1 offset 2

_____________________________________________
_____________________________________________
_____________________________________________
__
8)ORDER BY Quey on Standard Object :-
c)Parent to child query way :-
1)Select Id, Name ,(Select Id, Name From FIRs__r)
From Police__c ORDER BY Name Asc
2)Select Id, Name ,(Select Id, Name From FIRs__r)
From Police__c ORDER BY Id Asc

a)Child to parent quer way:-


2)Select Id , Name , Police__c.Id , Police__c.Name
From FIR__c ORDER BY Name Desc //error
3)Select Id , Name , Police__c.Id , Police__c.Name
From FIR__c ORDER BY Id Desc //error

==========================================
==========================================
==========================================
==================

++++++++++++++++++++++++++++++++++++++++++
+++++++++++ All Standard And Custom objects of on
'Includes' method +++++++++++++++++++++++++++++
+++++++++++++++++
Standard object :- INCLUDES means ki ye value jisme
hogi vo Record
1) Select Id , Education__c From Account Where
Education__c INCLUDES('B.E' ,'M.Tech')
2)Select Id, Education__c From Account Where
Education__c EXCLUDES('B.E','M.Tech')

Custom Object:-EXCLUDES means ki ye value jisme


hogi vo record chodke ke dusre Record
3)Select Id , Age__c From Police__c Where Age__c
EXCLUDES('Male' 'Female') // it is RUN bUt Age__c
field of Data type is Multiselect Picklist is necessary.

==========================================
==========================================
==========================================
==========================

++++++++++++++++++++++++++++++++++++++++++
+++++++++All Standard Object and Custom Object++++
++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++

1)Select FirstName , LastName ,Account.Name From


Contact Where Account.Name Like p%

2)Select Id , Name From Account Where Name like '%a'

3) Select Id , Name From FIR__c Where Name like '%a'

++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++
In SOSL Query for find query we can use to using
where clause like '*c'

==========================================
==========================================
===================

++++++++++++++++++++++++++++++++++++++++++
++++++++++++ Standard and Custom Object++++++++
+++++++++++++++++++++++++++++++

1)let us see an example on SOQL IN Operator:-

SELECT Firstname, Lastname FROM Contact WHERE


Firstname IN ( ‘Rose’, ‘Sean’ )

2)let us see an example on SOQL NOT IN Operator:-

SELECT firstname, lastname FROM Contact WHERE


firstname NOT IN ( ‘Rose’, ‘Sean’ )

==========================================
==========================================
====================

Imp Link For ALL SOQL Quries

1)https://www.salesforcetutorial.com/soql-logical-
operators-and-or/

++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++
+++++++++

1)Logical Operator “AND” is used to retrieve the records


when all the conditions in SOQL statement is satisfied.
If any of the condition in SOQL statement is not
satisfied records will not be retrieved.

Query:-SELECT name, Amount FROM opportunity


WHERE Amount > 1000 AND Amount < 10000

2)SOQL Logical Operator OR Logical operator OR is


used to retrieve the data if any of the condition in SOQL
statement is satisfied. SOQL logical operator “OR”
matches the first condition with second condition and
data will be retrieved.

Query :- SELECT name, Amount FROM opportunity


WHERE name = ‘express logistics‘ OR name =
‘GenePoint SLA’

++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++
++
List<String> child_address_list = new List<String>();

for(Parent__c objList : parent_list){

child_address_list.add(objList.Id);

}
for(childAddress__c oldobj : trigger.old){

if(parent_list.contains(oldobj.Parent__c)){
delete oldobj;
}
}
if(trigger.isAfter){

Database.querloader : 50 million record


Database.iterable:50 thousand record
Batch apex implement Database.batchable interface

We are having three compulsory methods in batch apex


start()
Execute()
Finish()

Global class AccountBatch implements


Database.Batchable<sObject>{
start()
Execute()
Finish()
}

You might also like