function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Emily soaresEmily soares 

Salesforce developer 1 - help with one question please

HI, i am practicing for Salesforce developer 1.  I came across this question and the answer offered didnt make any sense to me.

The operation manager at a construction company uses a custom object called Machinery to manage the usage and maintenance of its cranes and other machinery. The manager wants to be able to assign machinery to different construction jobs, and track the dates and cost associated with each job. More than one piece of machinery can be assigned to one construction job. What should a developer do to meet these requirements?
  1. Create a lookup field on the machinery object to the construction job object
  2. Create a junction object with Master-Detail Relationship to both the machinery object and the construction job object.
  3. Create a lookup field on the construction job object to the machinery object
  4. Create a Master-Detail lookup field on the machinery object to the construction job object

The answer provided was n.3.  I would have gone with n.2.

Would you be able to help me with this and explain the answer to this by any chance

Many thanks
 
Best Answer chosen by Emily soares
Niraj Kr SinghNiraj Kr Singh
Hi Emlly,

Answer should be n.2 only, because according to this scenario "More than one piece of machinery can be assigned to one construction job" we have to gowith M-M relationship which can be possible through junction object approah only.

All Answers

Niraj Kr SinghNiraj Kr Singh
Hi Emlly,

Answer should be n.2 only, because according to this scenario "More than one piece of machinery can be assigned to one construction job" we have to gowith M-M relationship which can be possible through junction object approah only.
This was selected as the best answer
Emily soaresEmily soares
Thanks Niraj
Mahendra ShamdasaniMahendra Shamdasani
A per my understanding, a construction job can have many machineries but a machinery can be assigned to only 1 construction job at a time.
Mahendra ShamdasaniMahendra Shamdasani
It's like Account and Contact relationship. Account can have many contacts linked to it. But a contact can be linked to only 1 account. So, answer should be n.1.
Kenneth Kim 18Kenneth Kim 18
I think the correct answer should be n.4 if the grammar is correct. Instead of "Create a Master-Detail lookup" if it says "Create a Master-Detail relationship", it would be the correct answer as the example goes, 1 construction job  can have many machinery.
Kenneth Kim 18Kenneth Kim 18
Also just to add furthur based on Mahendra's example on Account and Contacts, when you delete an Account, all associated Contacts will be deleted as well which is a known behavior of a Master-detail relationship.
 
Gug ChilGug Chil
So guys! what is the answer!?
for me it cannot be a master-detail relationship, since deleting the job will cause deleting a machinery, which is not so good!
Im confusing about junction object  and lookup relation
Lookup is a good choice, but it said "...and track the dates and cost associated with each job. More than one piece of machinery can be assigned to one construction job" so for me the first part means that each machinery can be "booked" for different job! /the same machinery for different job in different time/ and second part means different machineries for the one job!
So! For me the correct answer is N2: create junction object
Rajesh KanikeRajesh Kanike
I feel correct answer is Option 1: but not option 3,  ofcourse not 2 & 4
as per my  point of view: 1 construction job can have one or more machineries associated at a given point of time.
similarly 1 Machinery will be associated to ONLY 1 construction job at a given point of time.
this can be achieved by creating lookup relationship field on Machinery Object that opens up popup lookup list that shows Construction object records. (so you get to choose only 1 construction record)

why its not 2 & 4 (Master Detail relationship)  : both objects should be loosely coupled and independent of each other, if Construction is deleted Machinery should NOT get deleted  and vice-versa.

Please correct me if I am wrong..