function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sai kumar 49sai kumar 49 

differences between workflow and trigger?

lofrattinilofrattini
They both allow you to define business logic to be executed around the lifecycle of a record, but they are very different things.
At a very high level, here are the main differences:

Workflows 
  • Simple, but you have very limited possibilities on the logic to be executed
  • Logic defined via point and click limited 
  • Logic is limited to a bunch of available actions (update a field on the same record, send emails or outbound messages)
  • You cannot create a workflow around the deletion of an object
  • Unit tests are not required

Triggers
  • More complex, but you have maximum flexibility on the logic to be executed
  • Logic defined using Apex code
  • Business logic is pretty much anything you can code
  • Often needed when a record on a different object has to be created/updated
  • Unit testing is required