Book Image

Salesforce.com customization handbook

Book Image

Salesforce.com customization handbook

Overview of this book

Table of Contents (19 chapters)
Salesforce.com Customization Handbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

The Formula field


Formula fields in Salesforce are a special type of read-only fields that evaluate the specific equation at runtime and generate values accordingly. These fields are generally used where the data is entered by the user in a field and that data needs some logical processing and storage in another field. We need to define a formula expression/equation that will be executed while a record is being saved.

Let's start with an example. The event company Appiuss wants to calculate the age of the participants while they are registering for an event, depending on the date of birth the registrant entered at the time of registration. Additionally, they want to show it as a read-only field.

In order to fulfill this requirement, you can follow these steps:

  1. Navigate to Setup | Build | Create | Objects.

  2. Click on the label of the object; in our case, click on Event Registration.

  3. Under the Custom fields and relationships section, click on the New button. It will redirect you to a new window from...