Professional Documents
Culture Documents
Trigger Practice
Trigger Practice
1)What is Trigger
-Trigger helps to call a specific peice of code when something happens in salesforce.
Apex Trigger enables us to perform custom actions before and after events to record in
Salesforce
Trigger.New - When due to any records trigger gets fired then the latest version of that
record will inside trigger.new.
Trigger.newMap - When due to any reocord trigger gets fired Then the map of Id's to the
new version of the records will be inside Trigger.newMap
InValue - along side with Id entire record will be there.
Trigger.old - when due to any records trigger gets fired then the immdite previous version
of that record will be inside trigger.old.
Trigger.oldMap - When due to any records trigger gets fired then the map of ID's to the old
version of the records will be inside Trigger.oldMap.
8) Bullkyfication of trigger
-1) We must avoid using values like trigger.new[0] as we never know how many records we
may get at run time.
2) We need to use for each loop wether we have one record or many.
3) We must not use SOQL inside for Loop.
4) We must not use SOSL inside for Loop.
5) We must not use DML inside for Loop.
6) We need to store data in collections.
Lead Management - Leads are our procpects which can become petential customer after
lead nurturing (care or Protect) and when we convert a lead then three seperate record will
be create automatically which are account, contact and opportunity is optional
Account Management - Accounts are companies with which we are willing to do bussiess.
Contact Management - Contacts are the persons associated with perticular account.
Opportunity Management - Opportunity are the deals which we will be getting from
accounts or company.
Case Management - Cases are like customer complaints which are needed to be resolved
ASAP - We have case assignment rule so that cases can be assign with perticular users
depending on some conditions. - We have case escallation rules as well by which if the
certain case is not attended or closed in a specified time period it will automatically will be
assign to a different user.
What is vf page?
- It is a web development language created by salesforce.com syntax for this language like
HTML. -
1) To work on complex pages
2) To display record from multiple object
3) To edit multiple record at the same time
4) When we want more than two columns display of data
What is partial DML
- When we want to perfom partial insertion then we can use database class like
Database.insert (Same for the update)
Batch Apex : This is used to run large jobs which contains millions of records.
Queue able Apex : These are also like future methods but has an ability to chain jobs with a
class.
Scheduled Apex : These are scheduled to run at a specific time