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
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
Gabriel LinusGabriel Linus
Hi Mayank,

Workflow rules, roll-up summary fields, triggers, and formula fields are all powerful tools in Salesforce automation. Here's a brief overview and an example of when to use each:
  • Workflow rules : Use workflow rules when you need to automate a simple process that requires updating a single record or sending an email notification. For Example, you want to automate a process when a lead is converted to an account. You can create a workflow rule to automatically update the account owner to a specific user or queue.
  • Roll-up summary fields : Use roll-up summary fields to calculate values from related records in a master-detail relationship. For example, you can use roll-up summary fields to calculate the total amount of all related opportunity records on an account record.
  • Triggers : Use triggers when you need to automate a more complex process that requires multiple record updates, data validation, or custom logic that can't be handled with workflow rules or formula fields. 
  • Formula fields : Use formula fields when you need to perform a calculation or display data based on the value of other fields. For example, you can create a formula field to calculate the age of a contact based on their birthdate, or to combine the first and last name fields to create a full name field.
For those who want to learn more about Salesforce automation, I recommend referring to the article at https://arrify.com/salesforce-automation/. This guide offers a wealth of information on automation in Salesforce, including an overview of available automation tools and the latest updates in the field. By reading this article, you can gain a deeper understanding of how to leverage Salesforce automation to streamline your business processes and increase efficiency.