Reputation:
I have an EntityA with 2 Required lookup fields on it. First lookup field is the Contact, which auto populates when I add a new EntityA from the Contact.
The Contact is also associated with one to many of Another EntityB. EntityB is the Second lookup field on the EntityA. I would like to auto populate the EntityB field when the Contact has only one EntityB associated with it.
The end result should be when I selected to add an EntityA, it auto populates the Contact and Another EntityB (when there is only 1) and I fill in the rest of the fields.
I thought this might be OOTB or easily configurable because it makes sense to do when there is only one possible value and the Lookup field is required.
Upvotes: 0
Views: 1370
Reputation: 131
why not use Javascript on the selection for the first lookup to get data for the second using first lookup value joind with all the values related to it using fetchXML or Odata call and it's just a matter of setting fields and saving the form.
Upvotes: 1
Reputation: 22836
Relationships won't work like that. There is no 1:1 relationship in fact.
If you see, EntityA is N:N between EntityB and Contact literally. When you are creating EntityA from either end, from EntityB or Contact, that particular parent lookup will auto populate.
But the N:1 child record from selected parent cannot be populated (what logic you want system to apply to take the TOP 1 ??)
Either you should create a EntityB lookup field in Contact to capture the TOP 1 record (EntityB-1) & OOTB mapping can be used to populate this record while creating EntityA from Contact (this mapping will pull the field value like any other field from Parent)
Think this scenario like Account - Contact, though you may have N contacts for Account, you have to pick the Primary Contact. Same way Contact can work for N Account, but you have to tell the system whats the Primary Account he's looking into.
Upvotes: 1