Skip to main content
Join the Agentforce Hackathon on Nov. 18-19 to compete for a $20,000 Grand Prize. Sign up now. Terms apply.

Create a Self Relationship with the Position Object

Create a Lookup Relationship

When members of Ling Wu’s HR team are looking at a position in their recruiting app, she would like each recruiter to be able to identify other open positions that require similar skills or have similar job descriptions. This will allow recruiters to more easily determine appropriate roles for candidates.

You can set this up for her by creating a lookup relationship. Lookup relationships link two objects together. You can link an object with another standard or custom object, or you can link an object with itself—that’scalled a self relationship.

Start by creating a self relationship with the Position object.

  1. From Setup, click Object Manager.
  2. Click Position.
  3. Click Fields & Relationships, then New.
  4. Select Lookup Relationship as the Data Type.
  5. Click Next.
  6. In the Related To picklist, select Position.
  7. Click Next.
  8. Change the Field Label to Related Position and the Field Name to Related_Position.
  9. Click Next, Next and Next.
  10. Change the Related List Label to Related Positions.
  11. Click Save.

Add Lookup Filters

Now add lookup filters by department and record ID, to help recruiters narrow their searches.

  1. Click Down arrow next to Related Position and select Edit.
  2. In the Lookup Filter section, click Show Filter Settings.
  3. On the first filter line, click Magnifying glass and select Related Position from the first column, Department from the second column, and click Insert.
  4. For Operator, select equals.
  5. For Value/Field, select Field.
  6. Click Magnifying glass and select Position from the first column, Department from the second column, then click Insert.

Now fill in the next row of filter criteria.

  1. On the second filter line, click Magnifying glass and select Position from the first column, Record ID from the second column, and click Insert.
  2. For Operator, select not equal to.
  3. For Value/Field, select Field.
  4. Click Magnifying glass and select Related Position from the first column, Record ID from the second column, then click Insert.
  5. For Filter Type, ensure Required is selected.
  6. For If it doesn’t, display this error message on save, enter The related position must be in the same department. You cannot relate a position to itself.
  7. Click Save.

Now let’s test what you’ve just done by viewing a position in the Recruiting App.

  1. Click App Launcher icon to open the App Launcher, then click Recruiting.
  2. Click Positions, then New, then enter the details of the new position.

    Field

    Value

    Title

    Awesome Sales Rep

    Department

    Sales

    Approval Status

    Approved

    Location

    US

    Job Description

    Sales rep to join the AW Computing team serving the western region of AMER
  3. Click the Related Position field and select Super Sales Rep.
  4. Click Save.
  5. Notice that that Super Sales Rep appears as a Related Position for Awesome Sales Rep.

Awesome Sales Rep page showing Super Sales Rep as Related Position

Using relationships and filters, you’ve enabled recruiters to work more efficiently. Keep up the good work by creating custom fields.

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback