Process Builder vs Apex Triggers vs Workflow
When to Use Process Builder or Apex Triggers to Automate
Process Builder - Pros:
Ideal scenarios for using Process Builder.
1. Process Builder can do the following actions without Apex code:
Create records and set field values
Update related records
Create Chatter posts
Send an email
Create an approval
Simple triggers like populating a lookup field based on certain criteria can now be automated in Process Builder
2. Launch an automated flow.
3. Call an Apex class.
Process Builder – Cons:
Process Builders cannot handle before DML It executes after a record has been created or updated. Whereas Apex triggers can handle both before and after DML operations
Process Builder cannot handle delete and undelete DML. Whereas Apex triggers can handle all DML operations.
An error reported in Process Builder is more generic which makes it difficult to find the origin of the error. With Apex triggers, exception handling can be made more specific.
It is all or none in case of Process Builder failure. But with Apex triggers partial success is possible.
Workflow Rule
Things we can do using workflow are listed below
Update a field
Send an email
Create a Task
Send an outbound message.