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.
- Triggers can handle
before eventsand 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.
- We can execute business logic on
undeletecontext. That's not the case with Process Builder.
- We can delete records with Triggers but not Process Builders
- 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.
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.