Universal Containers は、個人に関する情報を保存する Applicant オブジェクトと、仕事を表す Job オブジェクトを備えた採用アプリを構築しています。各応募者は複数の仕事に応募できます。
応募者が求人に応募したことを表すために、開発者は何を実装する必要がありますか?
正解:A
A). Junction object between Applicant and Job:
Since anApplicantcan apply for multipleJobsand eachJobcan have multipleApplicants, this is amany-to-many relationship.
Salesforce requires ajunction objectto represent many-to-many relationships. The junction object will have two master-detail relationships: one to the Applicant object and one to the Job object.
The junction object could be named something like JobApplication__c, which would represent the specific instance of an applicant applying for a particular job.
Why this is the correct approach?
A junction object allows for robust data management and reporting capabilities in a many-to-many relationship.
This design ensures that each combination of applicant and job is captured as a unique record in the JobApplication__c junction object.
It also allows storing additional details about the application, such as application date, status, and feedback.
Why not the other options?
B). Lookup field from Applicant to Job:
A lookup field creates a one-to-many relationship. While an Applicant could reference one Job, it does not support the many-to-many relationship required in this scenario.
C). Master-detail field from Applicant to Job:
A master-detail relationship is a one-to-many relationship, which is unsuitable for a many-to-many relationship. Additionally, you cannot have two master-detail fields on a single object to connect Applicant and Job directly.
D). Formula field on Applicant that references Job:
A formula field cannot establish relationships between records or represent a many-to-many relationship. It is only for computed fields.
References:
Creating Many-to-Many Relationships with Junction Objects
Master-Detail and Lookup Relationship Details