Hello Naveen, Hope that your day is off to an amazing start. Best practices for Salesforce development is to use the simplest tool required for the job. APEX is the last thing you want to use out of your developer toolbox as it requires lots of testing and a change set to deploy. Below is a list of when to use which tool for the job on a basic level. Please let us know if you have any other questions and have a blessed day.
Workflow Rule - You have a business need that requires the evaluation of one criteria
Process builder - You have a business need that requires the evaluation of multiple criterion
Approval Process - You have a business need that requires the approval of someone else to be completed
Flow - You have a business need that requires a user's input in order to be completed (very dynamic)
APEX (Triggers or Class) - You have an advance business need that can't be fulfilled by any of the previous said tools
2:-- They currently can only result in a task, email, field update, or outbound message.
3:-- 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)We can not perform Dml operation in workflowWe cannot query from database.
4:-- Trigger can work across objects and where in you can query the object as well as you can do DMLs.
Trigger
1:-- Can do these things, but obviously using code.
2:-- Often needed for roll-up type scenarios where roll up summary fields cannot be used.
3:-- Often needed when a record needs to be created on a different objectWe can use 20 Dml operations in trigger. Trigger can be used to invoke a webserive.
4:- Trigger can work across objects and where in you can query the object as well as you can do DMLs.
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
If you want to know more about Trigger and workflow, please read below-
1. Workflow is point and clicks which doesn't need any coding. When you want to take action (email, task, field update or outbound message) for the same object or from Child to parent object, you can use Workflow rules.
2. Trigger: It's a programmatic approach and event-driven (insert, update, merge, delete). You can call it an advanced version of Workflow.
Trigger works across all the objects. You can create a new record through trigger which is not possible through a workflow.
Hope that your day is off to an amazing start. Best practices for Salesforce development is to use the simplest tool required for the job. APEX is the last thing you want to use out of your developer toolbox as it requires lots of testing and a change set to deploy. Below is a list of when to use which tool for the job on a basic level. Please let us know if you have any other questions and have a blessed day.
Best regards,
Anthony McDougald
Thank You
www.nubeselite.com
Developement | Training | Consulting
Please Mark this assolution if your problem resolved
Workflow
1:-- You cannot create records.
2:-- They currently can only result in a task, email, field update, or outbound message.
3:-- 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)We can not perform Dml operation in workflowWe cannot query from database.
4:-- Trigger can work across objects and where in you can query the object as well as you can do DMLs.
Trigger
1:-- Can do these things, but obviously using code.
2:-- Often needed for roll-up type scenarios where roll up summary fields cannot be used.
3:-- Often needed when a record needs to be created on a different objectWe can use 20 Dml operations
in trigger. Trigger can be used to invoke a webserive.
4:- Trigger can work across objects and where in you can query the object as well as you can do DMLs.
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
If you want to know more about Trigger and workflow, please read below-
1. Workflow is point and clicks which doesn't need any coding. When you want to take action (email, task, field update or outbound message) for the same object or from Child to parent object, you can use Workflow rules.
2. Trigger: It's a programmatic approach and event-driven (insert, update, merge, delete). You can call it an advanced version of Workflow.
Trigger works across all the objects.
You can create a new record through trigger which is not possible through a workflow.
For more information, refer these links-
https://www.quora.com/What-is-the-difference-between-trigger-and-workflow-in-salesforce
https://salesforce.stackexchange.com/questions/26929/workflows-vs-triggers
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com