Home SALESFORCEAPEX How to Choose to achive the Field Updates either using Workflow or Trigger

How to Choose to achive the Field Updates either using Workflow or Trigger:

Best practise to always use a workflow whenever possible and only use triggers when you cannot accomplish something using a standard workflow rule (field update).

here some few examples:

Master-detail Relationship:

1) Updating parent field value based on child field values (Workflow or Trigger)
Workflow Rule, because with master-detail relationship a child object we can update the parent object fields.

2) Updating child field value based on parent field values (Workflow or Trigger)
Apex Trigger, because you cannot update all children fields records from a workflow rule, no mater what the relationship is

Lookup Relationship:

3) Updating parent field value based on child field values (Workflow or Trigger)
Apex Trigger, because you can only update the parent fields record in a workflow rule if it is a master-detail relationship

4) Updating child field value based on parent field values (Workflow or Trigger)
Apex Trigger, because you cannot update all children fields records from a workflow rule, no mater what the relationship is

No Relationship Between Objects: (No Master-detail and No Lookup Relationship)

5) Updating parent field value based on child field values (Workflow or Trigger)
Apex Trigger, because without a relationship the workflow rule will not know which record to change

6) Updating child field value based on parent field values (Workflow or Trigger)
Apex Trigger, because without a relationship the workflow rule will not know which record to change

You may also like

Leave a Comment