Jan 6, 2012

Multiple Relationship & Mapping

CRM 2011 allows creating multiple relationship between 2 entities. In our implementation, I created primary contact and secondary contact lookup attributes on account entity. It works fine when we create an account and then associate primary & secondary contact to it.

The problem occurs when I tried creating it from left navigation link of accounts from contact entity. It set both primary & secondary contact to current contact which is not desirable. One just need to set primary or secondary at any given point of time. In my case, I need a primary contact.

I did it using following lines of code.

var formType = Xrm.Page.ui.getFormType();
if (formType == FORM_TYPE_CREATE) {

Hope it will be useful to you.

Happy Coding,

No comments: