Monday 18 July 2016

Difference between trigger and batch in salesforce

Apex Trigger Apex Batch
Triggers run each time a DML operation is called against a record Batch Apex runs across a (possibly large) set of data and performs some type of processing on it
A trigger is Apexcode that executes before or after some event (i.e. insert,update,delete,merge,upsert,undelete) Batch Apex runs whenever it is specifically called (or scheduled to run).
trigger not queued for run, which cause immediat action. Batch queued to run, which may cause delays in starting.There's a limit of 5 batches in play at any time.
but when that queue is full (Max. limit 5 concurrent batches), the job fails instead of being rescheduled for later processing.