Daniel Wu
Daniel Wu

Reputation: 1

Dynamics CRM - N:N relationship data/field/attribute mapping when creating record from subgrid

I'm using Dynamics 365 On-Premise 8.2, having an N:N relationship between entity Case & entity Contact and trying to do mapping between them for a required lookup field "Category", so that when I'm creating NEW Case record from the Case subgrid in Contact form, the lookup field "Category" is pre-filled/pre-populated with Case's Category value. Since it can't be done with data mapping (only applicable to 1:N relationship), I'm looking for a way to do that with custom code, but fail to construct it since I can't think of a way to pull the parent record creating the NEW record. Anyone knows how to pull the parent record when creating new record from N:N subgrid? Or any other way to accomplish the N:N attribute mapping purpose?

Thanks a lot in advance!

Upvotes: 0

Views: 591

Answers (1)

Daniel Wu
Daniel Wu

Reputation: 1

Read some blogs inspired me to look into how Lead & Account, Contact, Opportunity works and I found Lead having both N:1 & 1:N & N:N relationship with Account & Contact. Therefore, I solved it by created another entity B/"Case" lookup field in entity A/"Contact" (which is a N:1 relationship from Contact to Case), simulating the "Originating Lead" field & relationship in the OOB Contact & Account. Then the mapping works exactly what I want. Hope it helps someone in the future

Upvotes: 0

Related Questions