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
chanti kchanti k 

What is the major difference between workflow and trigeer?

Hi all,

I have little bit confuse, what is the major difference between trigger and workflow? I need the explain on scenario wise , give me best example ,what kind of situation we can choose trigger instead of workflow, kindly do the needful.


Chanti
ManojSankaranManojSankaran
Hi Chanti,

Workflow Rules
- are limited to perform only four operations (Create a Task, Update Field (Will update only the same record or the parent at a max), Outbound messages and email alert)

Triggers
- Triggers can be used to create a new record , List of records or even validate multiple records before updating the value.
- Trigger can be used to invoke a webserive
- Trigger can also be used for complex validation rules, but not the workflow rule.


Check these links for more information.

http://www.infallibletechie.com/2013/04/difference-between-triggers-and.html
http://salesforce.stackexchange.com/questions/26929/workflows-vs-triggers
http://www.salesforcetutorial.com/salesforce-interview-questions-answers-part2/

If this helps mark it as answer.

Thanks
Manoj S
JyothsnaJyothsna (Salesforce Developers) 
Hi Chanti,
  • The trigger can work across objects and where in you can query the object as well as you can do DMLs.
  • The workflow will be only helpful to update the same object or master object in custom master-detail relationships.We cannot query from database
  •  The trigger works before and after some actions.
  • Workflows work only after some actions.
  • Trigger get fired on more actions like on insert , update , delete and undelete.
  • Workflow gets fired on insert and update
  • Triggers can not be updated on production org after being created via a managed package.
  • Actions in workflows can be edited, removed and new actions can be added in production org.

Please check the below links for more information.
http://opfocus.com/when-to-use-a-workflow-vs-a-trigger-to-populate-a-field/

Hope this helps you!
Best Regards,
Jyothsna

 
Amit Chaudhary 8Amit Chaudhary 8
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......

Workflow
  • you cannot create records
  • they currently can only result in a task, email, field update, or outbound message
  • they can only cross objects in a master detail relationship, from the detail to the master, and only for certain scenarios (all custom to custom objects, some custom to standard objects, and even fewer standard to standard)

Trigger
  • can do these things, but obviously using code
  • often needed for roll-up type scenarios where roll up summary fields cannot be used
  • often needed when a record needs to be created on a different object
  • needed to kick off some apex code
  • many other reasons
User-added image

Let us know if this will help you
 
Deepali KulshresthaDeepali Kulshrestha
Hi Chanti,

I have gone through your question major difference between the Workflow and trigger:--

Workflow:-Work flow triggers when a DML event like Insert,Update Occurs.we can't fire workflows after a record has been deleted.

Workflow actions are     Field Update,Email alert, Task alert, and outbound message........ so u can any of action for workflow.so whenever workflow fires that action takes place.



Approval Process:-

suppose u can think like this, in a Software company there ia an HR team, whenever they open a position, that position has to approved by the HR team..if the Hr team approved that position then that position is approved and they start open recruitment. if they rejected  position then they doesn't open recuritment.........for that position



whenever a record submitted to the Approval process, the record is going into locking state.if it is approved then it is in locking state forever.if it is rejected then that records come into unlocking state.

In approval process we can trigger work flow when initial sumission,approval action, rejection action, final rejection.................





Trigger:-  Trigger is also same ,when an Dml event occurs like insert,update,Delete   trigger will fire......

here in deletion Scenario also trigger will fire....but in work flows workflow cannot fire..........for deletion



I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
Malika Pathak 9Malika Pathak 9

Hi chanti,

Find the below Solution

Both process trigger and workflow in Salesforce are great automation tools that make actions happen
without the need for manual interference.


Workflow

Workflow, on the contrary, is a click and drag tool that doesn't require any coding proficiency to be setup.
The workflow also runs over certain rules and criteria but cannot perform actions on multiple objects.
It is simpler set up but can only perform limited actions like updating fields,
send email alerts and outbound messages.


Trigger

The process trigger helps you execute an Apex code that automatically allows performing certain operations
like Insert, Delete, Create, etc. It can, simultaneously or at once,
act on multiple objects to execute the operation and follow specific criteria that determine the operation's execution.

In simple words, I would say that workflow is an automated process where an action is performed after evaluation.
Whereas, a trigger is a code command that executes before or after a record is updated/deleted or added.

Both are used for different purposes by Salesforce Consulting Partners.
If workflow/triggers are set up in the right manner, it can transform a business’s automation capabilities.

if you find this helpful mark it as the best answer.