Build a Data Model for a Recruiting App: Create a Self Relationship with the Position Object

Study for the Administrator Certification Exam > Object Manager and Lightning App Builder (15%) > Build a Data Model for a Recruiting App > Create a Self Relationship with the Position Object

HR팀에서 생각하기를 어떤 지원다는 다른 Position에 더 적합할거 같은데 지원자 서류를 보면서 비슷한 자격요건을 가진 다른 포지션을 볼수 있다면 좋겠다 싶습니다. lookup relationship로 구현해볼게요.

Create a Lookup Field

Position에 Related Position이라는 Lookup필드를 추가할게요:

  1. Setup > Object Manager > Position > Fields & Relationships > New
    • Data Type: Lookup Relaitonship
  2. Next
    • Related To: Position
  3. Next
    • Field Label: Related Position
    • Field Name: Related_Position
  4. Next, Next, Next
    • Related List Label: Related Positions
  5. Save

Add Lookup Filters

방금 생성한 Lookup필드에 department와 record ID로 검색하도록 필터를 추가합니다.

  1. Setup > Object Manager > Position > Fields & Relationships > Related Position > Edit > Lookup Filter > Show Filter Settings
    • Field: Related Position: Department
    • Operator: equals
    • Field: Position: Department
  2. AND
    • Field: Position: Record ID
    • Operator: not equal to
    • Field: Related Position: Record ID
  3. If it doesn’t, display this error message on save:
    • The related position must be in the same department. You cannot relate a position to itself.
  4. Save

Check the Result

  1. App Launcher > Recruiting > Positions > New
    *새로 추가한 Related Position이 아직 반영이 안되었을수도 있으니 Related Position필드가 보일때까지 새로고침을 합니다.
    • 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
    • Related Position: Super Sales Rep
      * 클릭하면 모든 포지션이 보이고, 검색하며 ID와 department로 검색이 됩니다.
  2. Save
    * 새로고침하면 Related Position이 레코드상세에 보입니다