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
Cherry@appsharkCherry@appshark 

Diff between Trigger and Workflow

Please differ Trigger and Workflow in salesforce..

 

What is the need for triggers when workflow exists?

Best Answer chosen by Admin (Salesforce Developers) 
hisrinuhisrinu

Trigger can work across objects and where in you can query the object as well as you can do DMLs

 

But workflows will only helpful to update the same object or master object in custom master-detail relationships.

 

There are several scenarios in which you can't achieve your functionality with workflows......

All Answers

hisrinuhisrinu

Trigger can work across objects and where in you can query the object as well as you can do DMLs

 

But workflows will only helpful to update the same object or master object in custom master-detail relationships.

 

There are several scenarios in which you can't achieve your functionality with workflows......

This was selected as the best answer
Pradeep_NavatarPradeep_Navatar

One of the best practice principles, we should try to follow when developing within Salesforce.com, and the Force.com platform, is to leverage native builder functionality first. If requirement can not be achieved through configuration only then we should try using Apex or Visualforce. One area where I am finding, more and more, that I no longer need to write code, and in particular Triggers, is for field updates.

 

Take an example where, say an opportunity stage  is set to "closed won", I want to set the value of my field Next Steps to "Inform the stake holders".  We could handle this in an Apex trigger set up to fire on Opportunity update: but workflow rules, and field update handle the process perfectly with no coding required.
DhairyaDhairya

Both are the trigger but the difference are

 

(1) Workflow : inbuilt functionality, used on single obj /master-detail

 

 (2) Trigger : Used for complex business process in which multiple Obj can handle. 

 

Before  jump  into coding check first is it possible to solve an issue using wfr.

 

Regards,

Dhairya