0
votes

I have 3 entities like Member, List and ListMember. Member and List have many-to-many relationship, as a Member can be added to multiple Lists and naturally a list have multiple Members added to itself. I'm trying to keep the related records of Members and List in the ListMember entity. That is, when a Member is added to a List, then there must be a record created in ListMember entity with the Member and List.

My first question is, is there any automated way to do this, that is, can I define ListMember entity as a many-to-many relationship keeper or something like that?

Second question is, if there isn't such a way, how can I trigger a process which creates records with the Member and List in the ListMember entity each time a Member is added into a List, and how can I reach data from both List and the Member in the process?

For more info about the problem, here is my previous question which reduced the situation into this triggering thing:

CRM Dynamics How to set short list - long list relationship

1

1 Answers

0
votes

You have 2 basic options when it comes to creating a M:M relationship in CRM:

  1. Add the relationship and defining it as M:M will create your ListMemeber Entity for you, and adding a List to a member, or a member to a list will be populated in the ListMember Entity.

  2. Roll your own Entity that basically does the same thing. You can also auto-populate fields on the form by looking up the regardingojectid

    regObj = Xrm.Page.getAttribute("regardingobjectid").getValue();

The regardingobjectid will return the referencing entity that you came from when creating a new entity. This will allow you to populate the side of the relationship that you came from, so the user just has to select the other entity.

It sounds like you want option 1, so I won't go anymore in-depth on Option 2.