Skip to main content

Create Cross-Object Formulas

Learning Objectives

In this project, you’ll:

  • Set up formulas and validation rules in an existing Recruiting app so users keep their data consistent.
  • Create roll-up summary fields to calculate the information users enter in the app.

Introduction

For this project, you continue customizing AW Computing’s Recruiting app, which the HR team uses as they work to place applicants into open positions in the company. For your first task, Ling Wu, vice president of human resources, has asked for help with keeping the candidate data the HR team enters into the app consistent. To accomplish this, use cross-object formulas.

Cross-object formulas incorporate fields from related objects for calculations and display on detail pages, list views, and reports. These formulas get data from related parent objects to display on the child object. Using them is a great way to avoid duplicate work, duplicate data, and data inconsistency.

Note

Before you can do this project, you must complete the Build a Data Model for a Recruiting App and Customize the User Interface for a Recruiting App projects. The work you do here builds on the work you complete in those projects.

Create a Cross-Object Formula

To take care of Ling Wu’s request, start by creating a cross-object formula field to display the Candidate full name on the Review object.

  1. From Setup, click Object Manager, then select Review.
  2. Click Fields & Relationships.
  3. Click New.
  4. Select Formula as the Data Type.
  5. Click Next, and fill in the details.
    • Field Label: Candidate Name
    • Formula Return Type: Text
  6. Click Next.
  7. Select the Advanced Formula tab, and add the formula in the box under Candidate Name (Text) = 
    Job_Application__r.Candidate__r.First_Name__c &" "& Job_Application__r.Candidate__r.Last_Name__c
  8. Ensure your screen looks like this. Advanced Formula tab showing the Candidate Name formula.
  9. Click Check Syntax to verify there are no errors.
  10. Click Next.
  11. Ensure the Visible checkbox is checked so all profiles are selected, and click Next.
  12. Click Save & New.

Now create a cross-object formula field to display Position Title on the Review object.

  1. Select Formula as the Data Type field.
  2. Click Next and fill in the details:
    • Field Label: Position Title
    • Formula Return Type: Text
  3. Click Next and add the formula under Position Title (Text) = (Note: The label of the Name field is Title.) 
    Job_Application__r.Position__r.Name
  4. Ensure your screen looks like this. Advanced Formula tab showing Position Title formula.
  5. Click Check Syntax to verify there are no errors.
  6. Click Next.
  7. Ensure the Visible checkbox is checked so all profiles are selected, and click Next.
  8. Click Save.

Finally, modify the Review page layout with a new section called Position & Candidate.

  1. While still viewing the Review in Object Manager, click Page Layouts.
  2. Click Down arrow icon next to Review Layout, and select Edit.
  3. Drag Section from the palette to below the Information section.
  4. For Section Name, enter Position & Candidate.
  5. Under Layout, Choose 2-Column.
  6. Click OK.
  7. Click and drag Position Title and Candidate Name from the Information section into the new section.
  8. Click Save.

By creating cross-object formulas, you’ve ensured Ling Wu’s HR team can enter clean, consistent candidate data in their recruiting app. Move on to the next step, where you create validation rules to make sure important data isn’t missing.

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities