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
nlsnydernlsnyder 

want to trigger some code when an opportunity's status changes to "Closed Won"

Should I create a trigger for opportunity for update or use a workflow rule on opportunity?   Which is better and why?

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
ShamilShamil

It depends on what exactly you're trying to achieve.

Best practice is not to write any code unless you absolutely have to, so try using workflow rules. Best part about workflow or any 'point-and-click' configuration for that matter, is that you don't need to write any code and things are easily configurable.

If workflow cannot meet the requirements you'd have to create a trigger. E.g. if you have a logic that needs to process multiple records, most likely you need a trigger.

 

HTH