Create Formula Fields | Trailhead Screen Reader Instructions

Introduction

VP of Sales Allison Wheeler has requested your help in collecting additional information on opportunities. First, she’d like sales and executive users to see their commission calculated for won opportunities. She’d also like the regions and zones of accounts displayed on opportunities for all to see. And, in an effort to enhance pipeline accuracy, she’d like to display the discounted amount whenever a discount has been applied to an opportunity

Handle these requests by creating custom formula fields, which allow you to define calculations that reference other fields to display new numeric, text, date, or checkbox values specific to business requirements. Let’s get started.

Calculate the Commission

Create a custom formula field on the Opportunity object that calculates 10 percent commission whenever an opportunity is closed won.

  1. From Setup, select the Object Manager  tab and select Opportunity from the objects table.
  2. Select the Fields & Relationships tab then activate the New Custom Field button.
  3. Select Formula as the Data Type, then press ENTER on the Next button.
  4. Enter Commission as the Field Label.
  5. Select the Currency  radio button as the Formula Return Type.
  6. Activate the Next button.
  7. Select Amount from the Insert Merge Field combo box. This combo box poses some challenge to screen readers. With JAWS, press ENTER on the combo box and then press ALT DOWN ARROW to expand the list in order to navigate through it and make a selection. With NVDA, you must press ENTER on the field and then SPACEBAR to view and navigate the expanded list.
  8. Press ENTER on Insert Operator  to expand the list. Choose the option for *Multiply.
  9. In the formula editor text field, ensure your cursor is at the end of the field. Type 0.1
  10. Ensure the final formula looks like the text below.

Amount * 0.1

  1. Activate the Check Syntax button to ensure there are no errors.
  2. For Description, enter:

Calculates sales rep commission of 10 percent when opportunity is won.

  1. For Help Text, enter:

Sales rep commission when opportunity is won.

  1. Activate the Next button.
  2. In the Visible column header, select the checkbox and then deselect it again to clear the checkboxes from all rows underneath.
  3. In the Visible column, select Sales User and System Administrator.
  4. Activate the Next  button then the Save button.

Next, modify the formula so that the commission is only calculated when an opportunity is closed won.

  1. While still in Fields & Relationships for the Opportunity object, locate Commission in the table of fields.
  2. At the end of its row, press ENTER on the Show More expandable menu, and select Edit from the menu. Alternatively, press ENTER on the Commission link, then activate the Edit button.
  3. Under the Formula Options heading, activate the link for Advanced Formula, and then modify the formula.
  4. In the Formula Editor text field, place the cursor just before Amount.
  5. Tab past the formula editor field to locate the Functions List combo box. From the Functions list combo box, select IF, then activate the Insert Selected Function button.
  6. From the Functions list again, place focus on ISPICKVAL, but don't activate the Insert Selected Function button yet.
  7. Go back to the formula editor field, highlight the words logical_test (do not highlight the parentheses), then tab to the Insert Selected Function button and press ENTER.
  8. In the formula editor field, highlight picklist_field and do not highlight the parentheses around it.
  9. Navigate up the page to find the Insert Field button and press ENTER on it. select Stage from the second combo box on the page, and then activate the Insert button.
  10. In the formula editor field, highlight text_literal and type in the words "Closed Won" (including the quotation marks).
  11. In the formula editor field, highlight Amount * 0.1 and cut it (Ctrl or Command+X).
  12. In the formula editor field, highlight value_if_true and paste (Ctrl or Command+V).
  13. In the formula, highlight value_if_false and enter 0.
  14. Ensure your formula looks like this:

IF( ISPICKVAL( StageName , "Closed Won") , Amount * 0.1, 0)

  1. Activate the Check Syntax button.
  2. Activate the Save button.

Customize Formula Fields

Create a custom formula field on the Opportunity object that displays the Region and Zone information from the account record.

  1. While still in Fields & Relationships for the Opportunity object, activate the  New Custom Field button.
  2. Select Formula as the Data Type, then press ENTER on  Next.
  3. Enter Region/Zone as the Field Label.
  4. Select Text as Formula Return Type.
  5. Activate the Next button.
  6. Press ENTER on the  Advanced Formula link.
  7. From the Functions list combo box, select TEXT, and then activate the Insert Selected Function button.
  8. In the formula editor field, highlight value.
  9. Activate the Insert Field button located above the edit field and select Account> from the second combo box on the page.
  10. From the new combo box that appears, select Region, then activate the  Insert button.
  11. Position the cursor at the end of the formula edit field, exit the field and browse up the page by arrow key.
  12. Press ENTER on Insert Operator. Links will expand here, though your focus may jump up the page and lose your place.
  13. Navigate back down the page to this area and select the link for &Concatenate.
  14. At the end of the formula edit field, enter "/" (including the quotation marks).
  15. Press ENTER on Insert Operator again, and then select &Concatenate.
  16. From the Functions list combo box, select TEXT, and then activate the Insert Selected Function button.
  17. In the formula, highlight value.
  18. Activate the Insert Field  button and select Account> from the second combo box on the page.
  19. From the new combo box that appears, select Zone, and then activate the Insert button.
  20. Ensure your formula looks like this:

TEXT( Account.Region__c ) & "/" & TEXT( Account.Zone__c )

  1. Activate the Check Syntax button.
  2. For Description, enter:

Displays the Region and Zone values from the account record.

  1. For Help Text, enter:

Account region and zone.

  1. Activate the Next button, the Next button again, and finally the Save button.

Next you create a formula field called Amount after Discount to calculate the amount after the discount has been applied. But first, create a custom percent field called Discount Percentage.

  1. While still in Fields & Relationships for the Opportunity object, activate the  New Custom Field button.
  2. Select Percent as the Data Type and press ENTER on  Next.
  3. Enter Discount Percentage as the Field Label.
  4. Enter 3 for Length.
  5. Activate the Next button.
  6. Select then deselect the checkbox in the Visible column header to clear out the checkboxes.
  7. Select Sales User and System Administrator.
  8. Activate the Next button and then the Save button.

Now create the formula.

  1. While still in Fields & Relationships for the Opportunity object, activate the  New Custom Field button.
  2. Select Formula as the Data Type and press ENTER on  Next.
  3. Enter Amount After Discount as Field Label.
  4. Select Currency as Formula Return Type.
  5. Activate the Next button.
  6. Activate the link for Simple Formula  to switch the editor to the Simple Formula interface.
  7. Activate the Insert Field combo box and select Amount. Remember, JAWS users will need to press ALT DOWN ARROW to expand it. NVDA users will press ENTER and then SPACEBAR.
  8. Press ENTER on the Insert Operator text above the formula editor. From the expanded list of links below it, select *Multiply. Remember that your focus may be lost when you expand the list, so navigate back down the page to locate the list of operator choices.
  9. Press ENTER on Insert Operator  again and select ( Open Parenthesis.
  10. After the open parenthesis, enter 1 into the formula editor field.
  11. Press ENTER on Insert Operator and select -Subtract.
  12. From the Insert Field combo box, select Discount Percentage as the field.
  13. Press ENTER on Insert Operator and select ) Close Parenthesis.
  14. Ensure your formula looks like this:

Amount * ( 1 - Discount_Percentage__c )

  1. Activate the Check Syntax     button to check for errors in your formula.
  2. For Description, enter:

Calculates the opportunity amount after any discount has been applied.

  1. For Help Text, enter:

Opportunity amount after discount has been applied.

  1. Activate the following buttons: Next, Next, and Save.

You’ve helped make necessary information available to Allison’s sales team with formulas. Move on to the next step, where you create record types.

Click to return to the unit on Trailhead to verify this step.