Process Builder vs Apex Triggers when to use what?

Let's look at one of the most frequently asked Interview Questions. Process Builder vs Apex Triggers when to use what?

I have searched for several articles that highlights the differences between Process Builder vs Apex Triggers and specifies when to use what.

I was not able to find any content that nails it. So, what next? I decided to write a post on that.

Apex Triggers

  1. Triggers can handle before events and that’s not the case with Process Builders. Actions in Process Builders are executed after records are created or updated. Because of the fact that actions are performed after the record is created or updated in Process Builders it's going to consume more DML.
  2. We can execute business logic on delete and undelete context. That's not the case with Process Builder.
  3. We can delete records with Triggers but not Process Builders
  4. We can use Database.insert(records, allOnNone) to save partial records and that not possible with Process Builders. In later case it will rollback the complete transaction if something goes wrong.

Process Builder

1. We can use out of the box actions like post to chatter and submit record for approval without any complex code. We don't have to take the hassle.