+ Start a Discussion
Mayank_SareenMayank_Sareen 

when to use workflow rule, roll up summary, trigger or formula field.

Hi all,
I am not able to understand that in what cases do we create a workflow rule, a roll up summary ,a trigger or a formula field , its really confusing .I looked this up on internet as well but its not clear. Can anyone help me with this.

Thanks.
Best Answer chosen by Mayank_Sareen
Shubham NandwanaShubham Nandwana
Hi Mayank,
1. Workflow rules are mainly used to automate different tasks like sending a mail alert to the user update  a field etc.
Each workflow rule consists of:
Criteria that cause the workflow rule to run.
Immediate actions that execute when a record matches the criteria. 
Time-dependent actions that queue when a record matches the criteria, and execute according to time triggers. 
Check https://developer.salesforce.com/page/Workflow_Rules for more understanding.

2. Roll up summary fields-roll-up summary fields calculate values from a set of related records, such as those in a related list. You can create roll-up summary fields that automatically display a value on a master record based on the values of records in a detailed record. These detail records must be directly related to the master through a master-detail relationship.
4 types of roll-up summary fields are there  Count, Sum, Min, Max.
Check  https://trailhead.salesforce.com/en/modules/point_click_business_logic/units/roll_up_summary_fields for more understanding.

3. Trigger -you use triggers to perform operations based on specific conditions (before or after insert/update/delete/merge/upsert/undelete), to modify related records or restrict certain operations from happening. You can use triggers to do anything you can do in Apex, including executing SOQL and DML or calling custom Apex methods
Check https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm for further understanding.

4.Formula fields:Your users need to access and understand this data at-a-glance without doing a bunch of calculations in their heads. Enter formula fields, the powerful tool that gives you control of how your data is displayed. Formula editor is very easy  to use and provides lots of different functions for different calculation.
Check https://trailhead.salesforce.com/en/modules/point_click_business_logic/units/formula_fields for understanding and using formula editor.

Mark this as solved if it helps.

Shubham Nandwana.
AppPerfect Corp.
salesforce@appperfect.com
408-252-4100
http://www.appperfect.com/services/salesforce/
Salesforce Development & Operations Experts
 

All Answers

Ajay K DubediAjay K Dubedi
Hi Mayank 

Workflow Rule - Workflow rules can help automate the following types of actions based on your organization's processes: Tasks: Assign a new task to a user, role, or record owner. Email Alerts: Send an email to one or more recipients you specify. Field Updates: Update the value of a field on a record.

Roll up Summary - A roll-up summary field calculates values from related records, such as those in a related list. You can create a roll-up summary field to display a value in a master record based on the values of fields in a detailed record.

Trigger - Apex triggers enable you to perform custom actions before or after changes to salesforce records, such as insertions, updates, or deletions. A trigger is Apexcode that executes before or after the following types of operations: insert. update. delete.

Formula Field - A formula can contain references to the values of standard or custom fields, operators, functions, literal values, or even other formulas. They're generally composed of the following components: Literal Values - A text string or number you enter that is not calculated or changed.

Mark it best if it helps you.

Thank you
Ajay Dubedi
Shubham NandwanaShubham Nandwana
Hi Mayank,
1. Workflow rules are mainly used to automate different tasks like sending a mail alert to the user update  a field etc.
Each workflow rule consists of:
Criteria that cause the workflow rule to run.
Immediate actions that execute when a record matches the criteria. 
Time-dependent actions that queue when a record matches the criteria, and execute according to time triggers. 
Check https://developer.salesforce.com/page/Workflow_Rules for more understanding.

2. Roll up summary fields-roll-up summary fields calculate values from a set of related records, such as those in a related list. You can create roll-up summary fields that automatically display a value on a master record based on the values of records in a detailed record. These detail records must be directly related to the master through a master-detail relationship.
4 types of roll-up summary fields are there  Count, Sum, Min, Max.
Check  https://trailhead.salesforce.com/en/modules/point_click_business_logic/units/roll_up_summary_fields for more understanding.

3. Trigger -you use triggers to perform operations based on specific conditions (before or after insert/update/delete/merge/upsert/undelete), to modify related records or restrict certain operations from happening. You can use triggers to do anything you can do in Apex, including executing SOQL and DML or calling custom Apex methods
Check https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm for further understanding.

4.Formula fields:Your users need to access and understand this data at-a-glance without doing a bunch of calculations in their heads. Enter formula fields, the powerful tool that gives you control of how your data is displayed. Formula editor is very easy  to use and provides lots of different functions for different calculation.
Check https://trailhead.salesforce.com/en/modules/point_click_business_logic/units/formula_fields for understanding and using formula editor.

Mark this as solved if it helps.

Shubham Nandwana.
AppPerfect Corp.
salesforce@appperfect.com
408-252-4100
http://www.appperfect.com/services/salesforce/
Salesforce Development & Operations Experts
 
This was selected as the best answer