In addition to setting up the structure of your data model, you also need to consider how you want the organization to dynamically respond as your data changes. As users manipulate, add, and delete data over time, you may want your app to automate a response action.

What processes do you expect to occur more than once over time? Are these responses always going to happen after a set of criteria is met? Could any of these cues branch off to multiple reaction flows based off of a specific condition? Do any approvers need to approve or react to your app's changes?

If you answered yes to any of these questions, formulas, workflow, flows, or approval processes could be the answer to helping you streamline these processes. Anywhere you can automate processes in a configuration-driven approach can increase the overall effectiveness of your app. This article will walk you through the different point-and-click automation tools and give you context into where they can be strategically applied.

Automate Calculated Fields

It is not uncommon for fields to be dependent on other fields. For example, picture a typical invoice statement. There are several calculated fields on an invoice, such as the line item total (price * quantity), the subtotal (sum of line item totals), tax (percent * subtotal), and the grand total (tax + subtotal). Traditionally an end-user would manually calculate these fields before entering data, or a back-end process would be written to compute the changes. Salesforce is able to perform these calculations and evaluations on the data automatically using formula fields and roll-up summaries. Naturally, you can do all of this without writing a shred of code.

Formula Fields

The first way to build an automated calculated field is by using a formula field. A formula field is a read-only field that derives its value from a formula expression you define. A formula field looks similar to an equation made up of different functions and source fields, and is automatically updated when any of the source fields change. Refer to the "Data Integrity" section on the validate and populate your data article where a validation rule is evaluated using a complex formula.

You can build formula fields using fields of varying data types to generate several different return types. When creating your formula field, you use various categories of functions and string them together as necessary. The formula screen provides a few outlets for help: the syntax button for checking your formula, functions with descriptions/syntax documentation, insert field/operator for building your formula with the right components, and the help links. All of these are highlighted in the image of the line item total field below.


To add a field into your formula, click the Advanced Formula tab and click the Insert Field button. Navigate to the field you are looking for by traversing the different relationship trees to ensure that you have the proper syntax. In a formula field, the proper syntax for displaying a field is to use a merge field, which references the value of the field by displaying the field’s API name. If you know the API name of the field offhand, you can type it in rather than using the Insert Field button.

Formula insert field.jpg

In the screenshot above, the email field I am grabbing is not on the object that I am creating the formula field on. As such, I need to traverse through my relationship field to get to the parent field. If you select the email field on the parent (manager) object, the merge field in my formula will look like:


The difference in syntax between grabbing a field off of the current object and a parent object is the suffix on the API name. By changing the __c on the relationship field to __r, you can grab fields off of the object through the relationship field. This will allow you to use fields without having to query for them.

Roll-up Summary Fields

Formula fields are ideal for displaying calculated data off of fields from the current record and the related parent record. For example, you'd use a formula field to calculate the total for an invoice line item (price * quantity). If you are trying to display calculated data based off of child records on the parent, you need to use a roll-up summary. To follow the same example, you'd use a roll-up summary field to calculate an invoice subtotal (adding up all of the child line item totals on the parent).

A roll-up summary can also be used to calculate the sum, minimum, or maximum value of all the values of a particular field in a related list, or the record count of all records listed in a related list. One thing to note is that you can only use a roll-up summary if the relationship between the two objects is a master-detail relationship.

Note that roll-up summary fields can only be used on the master side of a master-detail relationship, and that the field is read-only.


Create a Workflow

As you evaluate your requirements and build out your organization, you'll find some processes that can be automated through the use of a workflow. Workflows are automated responses that execute predefined actions when a set of criteria on the rule is met.

For example, you can set up a workflow rule that sends a Welcome email whenever you have a new customer. Or you could have a workflow populate a field based on a set of conditions, such as a discount based on the size of an order. You can even use workflow to set off a complex series of coded procedures in the database. Workflow rules are powerful, and yet easy to create.

To set up workflow rules, you first create evaluation criteria specifying when the rule should run. After this you create filter logic for the rule criteria so that the workflow rule will only run an action in the specific instances you want. Similar to formula fields, you can add logic around multiple fields of different types, and then add advanced logic filters to string the criteria together.

You can configure workflow actions to execute immediately when a record meets the conditions in your workflow rule, or set time triggers that execute the workflow actions on a specific day. A workflow action is an email alert, field update, outbound message, or task that fires when the conditions of a workflow rule are met. You can specify one or multiple workflow actions for any given workflow rule.

Create a Flow

Visual workflow, also known as flow, is a workflow that has the potential for different outcomes and is dependant on human interaction to progress within the flow. The differences between flow and workflow are first apparent when comparing what the two look like during creation. Workflow is a wizard for setting up configurations for your procedure, and flow is a design tool with drag and drop components to make a dynamic flow chart.

Visual Workflow

While workflows always follow the same protocol (when a criteria is met run its associated action), flow has conditional statements that could evoke a completely different set of actions based off of a choice within the decision tree. Flow, like workflow, will run associated actions after cues from the end user, but it extends workflow by also being able to redirect the user and respond with varying actions.

Create an Approval Process

In addition to workflow rules, has approval processes to extend workflow functionality and allow users to approve records while maintaining an audit trail on the approval history. When defining an approval process, you specify who must approve the record and in what order the approval flow must go. You can setup initial actions, actions on individual steps, and actions for after the record has been fully approved or rejected.

Approval Process Filter Criteria

Setting up an approval process is very similar to workflow. First you setup your entry criteria, which defines when to fire the approval process. Then you select who will need to approve the record or set of records after the approval process starts. A set of actions will execute both when the approval fires and when it finishes, and you can define those actions from the setup. Just like workflow actions, approval processes can send an email alert or outbound message, update a field, or create a task.

Approval processes fire off of a single record, and as such can also be tracked in the approval history related list on that record's detail page. Each process has an audit trail that shows you where in the approval process the record is and when an approval has been approved or rejected.


There are several manual processes that can be automated using the business logic point-and-click tools. First, in regards to data entry, you can configure automatic calculation updates on your data through use of formula fields or roll-up summaries. If you have actions that need to happen after changes are made within your organization, a workflow, flow, or approval process might be the solution for you.

Using these resources to build out the functionality of your org can increase the efficiency of your applications as well as ensure the effectiveness of the overall system. Automated business logic eliminates the potential of manual calculation/entry error and provides an audit trail of the different processes so you can track when things were done or what part of the process they are in.

Related Resources