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
charanteja vcharanteja v 

What is difference between Trigger and workflow Explain with one example in Detail?

SandhyaSandhya (Salesforce Developers) 
Hi,

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) https://help.salesforce.com/HTViewHelpDoc?id=workflow_cross_object_field_updates.htm&language=en_US
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

Please check below post i hope that will help you
 https://www.youtube.com/watch?v=hvNQZtld7kk (http:// https://www.youtube.com/watch?v=hvNQZtld7kk)
 https://success.salesforce.com/answers?id=90630000000gnMfAAI (http:// https://success.salesforce.com/answers?id=90630000000gnMfAAI)
 https://developer.salesforce.com/forums/?id=906F0000000AvHRIA0 (http:// https://developer.salesforce.com/forums/?id=906F0000000AvHRIA0)


 Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
 
Thanks and Regards
Sandhya

 
Deepali KulshresthaDeepali Kulshrestha
Hi Charanteja,

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 the 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 is an HR team whenever they open a position, that position has to approved by HR team..if 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 an 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 an unlocking state.



in the approval process, we can trigger workflow when initial submission, approval action, rejection action, final rejection.................





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

here in deletion Scenario also trigger will fire....but in workflows 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