Create a Formula Field
Follow Along with Trail Together
Want to follow along with an instructor as you work through this step? Take a look at this video, part of the Trail Together series on Trailhead Live.
(This clip starts at the 41:00 minute mark, in case you want to rewind and watch the beginning of the step again.)
A formula field performs a calculation or populates data between fields to reduce errors—and help keep things nice and clean. They output read-only numbers, text, or date/time values and can access related data with merge fields. Note that the calculated value is not stored, but rather calculated each time data is read. Use formula fields to improve data quality by deriving values from other fields and preventing redundant data.
Display Revenue on an Opportunity Record
Allison Wheeler has another keep-it-tidy task for you. She wants all opportunities to show the annual revenue of the account. Since Annual Revenue is already a field on the Account object, this information must appear on the Opportunity object without duplicating the data already being stored.
Create a formula field to display the account annual revenue on opportunity records.
- From Setup, click the Object Manager tab.
- Click Opportunity, click Fields & Relationships, then click New.
- Select Formula, then click Next.
- In the Field Label field, enter
Account Annual Revenue.
- Select Currency, then click Next.
- Click the Advanced Formula tab.
- Click Insert Field and select Account > from the second list.
- From the new list that appears, select Annual Revenue, then click Insert.
- Verify that the formula looks like this:
- Click Check Syntax.
- In the Description field, enter
Displays the account annual revenue on an opportunity.
- Click Next.
- Leave the field-level security as is, and click Next.
- Click Save.
Now that you’ve put the kibosh on redundant data with a formula field, continue keeping things clean in the next step of this project, where you do some filtering.