function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Praveen kumar TammaliPraveen kumar Tammali 

Difference between Before update and After update Triggers

Hi All,
Can some one please explain "why do we need after update trigger when we can do everything in before upadte triger in sales force"
Thans in advance
Praveen.
AshlekhAshlekh
Hi,

Here is some conversation on this topic.

http://stackoverflow.com/questions/3646110/difference-before-and-after-trigger-in-oracle
https://developer.salesforce.com/forums/?id=906F00000008yLuIAI

-Thanks
Ashlekh Gera
DavidGantDavidGant
Praveen,

The simple answer I have always used is that Before triggers should update the actual record(s) that called the trigger while After triggers should update related objects. Example: A Case is edited and saved, which causes the Case Trigger to make two updates to the Case itself (Before) and add/remove Milestones and Entitlements related to the Case (After). 

This a general rule and is not without myriad exceptions, but it tends to keep me out of trouble more often than not.