Salesforce Admin Tutorial – 6

Salesforce Admin Tutorial – 6

On April 6, 2023, Posted by , In Admin,Admin Tutorial, With Comments Off on Salesforce Admin Tutorial – 6

Formula Fields

Formula fields are a special field type that is read-only and automatically generated by the system. 

For example, if you have two fields A and B want to insert the sum of A and B into another field called C, you can set up C as a formula field. It automatically calculates the C value whenever A and B are first entered or modified.

Previous article, Salesforce Admin Tutorial – 5, explains about Fields.

Salesforce also gives us numerous built-in functions to calculate the value of a formula field. Functions like Today or Distance are examples of these. 

Let’s see how we can create an Age formula field that calculates the age of an employee using their date of birth. 

We start the process by opening the new field option on the Fields & Relationships pane. Here, we have to set the field’s data type to “Formula” to make it a formula field. 

Once it’s selected, the next page allows us to add the field name and data type of the output. Since age is a number, we select the Number field with zero decimals in this case. 

On the next page, we have the ability to add a simple or advanced formula that calculates the field output. In the Advanced Formula option, Salesforce allows us to use its built-in functions to build the formula. And we need the Today function to find the age in this example. 

The formula we use to calculate the age is as follows:

(TODAY()- Date_of_Birth__c) / 365.25

You can pick the TODAY() function used here from the Functions dropdown to the right side of the input box. To add the custom Date of Birth field to the formula, click the “Insert Field” button and choose the required field listed under the Employee object. 

You can validate the entered formula using the “Check Syntax” option at the bottom. If it’s error-free, complete the rest of the field creation as before.  

You can create a new employee record to see how this new field works in action. This field will also show up in the older records you created if they have the date of birth set. 

Next article, Salesforce Admin tutorial -7 explains about Page layouts.

Comments are closed.