What Is Formula Field and How to Create
What is formula field?
It is a read only field, the value of formula filed evaluate from expression defined by you based on the requirement. If we update any source field value used in the expression, it automatically updates formula field value automatically. We can create formula fields in both custom and standard object.
To build your formula:
Always remember to begin building with a formula field the same way you create a custom field in either custom or standard object. See Create Custom Fields.
Step 1. Choose the data type Formula and click Next button.
Choose the appropriate data type based on the requirement for your formula based on the output of your calculation. We can return formula result in 7 ways those are showing in the below screen
Step 2. Fill the Field label, Field Name and choose your return type (always remember that formula field always return a value) and click Next button.
Note: Always remember Salesforce uses the round half up tie-breaking rule for numbers in formula fields in Salesforce. For example, 15.678 becomes 15.68 and −15.678 becomes −15.67.
Step 3. Build your formula:
If there is a requirement of building a formula from an Advanced Formula tab or for approvals or rules, such as validation, workflow, assignment, auto-response, or escalation, click on Insert Field, choose a field, and click Insert.
To create a basic formula that passes specific Salesforce data, just select a Simple Formula tab and then choose the field type from the Select Field Type drop-down list, and choose one of the fields listed in the Insert Field drop-down list based on the need.
To check for any errors in formula field, click Check Syntax and Click Next button
Step 4. Now its time to set the field-level security to determine whether which field should be visible for specific profiles, and click Next button
Step 5. Now choose the page layouts that should have this field. The field is added as the last field in the first two-column section on the page layout by default. For user custom fields, created field is automatically added to the bottom of the user detail page.
Click on Save to finish or Save & New to create more custom fields if required.
Note : As we already aware that formula fields are automatically calculated, they are universal read-only field on record detail pages as well as do not update last modified date fields. Always remember that formula fields are not visible on edit pages.The formula field is updated when any of the source fields got changed. Formula Field always returns a value.