Difference between trigger and workflow rule

Workflow Rules:

  • Workflow is an automated process that fired after an action, based on evaluation criteria and rule criteria.
  • Workflow actions are Field Update, Email alert, Task alert and outbound message.
  • Workflow will be helpful to update the same object or master object in custom master-detail relationships.
  • We cannot fire workflows after record has been deleted.
  • We cannot query from database on workflow.

Trigger:

  • Trigger is a piece of code that executes before or after, when an DML event occurs like insert, update or Delete.
  • Trigger executes before or after these types of operations insert, update, delete, merge, upsert & undelete.
  • We can access the trigger across the object and related to that objects.
  • We can use DML operations in one trigger.
  • We can use SOQL’s from data base in one trigger.