Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

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
  1. Click Next.
  2. 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
  3. Ensure your screen looks like this. Advanced Formula tab showing the Candidate Name formula.
  4. Click Check Syntax to verify there are no errors.
  5. Click Next.
  6. Select the Visible checkbox so all profiles are selected.
  7. Click Next, Next, then 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
  1. Click Next and add the formula under Position Title (Text) = . 
    Job_Application__r.Position__r.Name
  2. Ensure your screen looks like this. Advanced Formula tab showing Position Title formula.
  3. Click Check Syntax to verify there are no errors.
  4. Click Next.
  5. Select the Visible checkbox so all profiles are selected.
  6. Click Next, Next, then Save.

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

  1. While still viewing Review in Object Manager, click Lightning Record Pages.
  2. Click Review Record Page, then click Edit.
  3. Click the Fields tab, then drag a Field Section from the palette to below the Information section.
  4. For Label, enter Position & Candidate.
  5. Under Layout, choose 2 Columns.
  6. Drag Position Title and Candidate Name from the palette into the new section.
  7. 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.

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback