Tuesday, September 17, 2013

Choosing Workflow or Trigger for Field Updates

Keep in mind that you should always use a workflow when possible!  Only use triggers when you cannot accomplish something using a workflow.

See below for which to use and why:

----Master-detail Relationship----

1) Updating parent picklist value based on child picklist values (Workflow or Trigger)
>> Workflow, because with master-detail relationship a child object can update the parent

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

----Lookup Relationship----

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

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

----No Relationship Between Objects----

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

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


Enjoy with Salesforce.....

No comments: