AnsweredAssumed Answered

How to keep an active/inactive flag for many to many relationships?

Question asked by jlabuelo on Nov 11, 2014
Latest reply on Nov 19, 2014 by jlabuelo
Hi there, have a question here

We have created two custom modules in our SugarCRM CE 6.5. One is called "Animals" and the other is called "Owners". We have defined a many to many relationship between Animals and Owners however it has a little detail to have in mind

Let me explain. An owner can have several Animals, so far so good, and an Animal can belong to several Owners, however it can belong to several onwers once at a time.

This could be solved witn a 1:n relationship, I know, but the difference is that we need to keep a historical record of the Animal, so we need to know the owners that the animal had during his all life.
Our idea is to keep this Many to Many Relationship between these two beans, and maintain, using logic_hooks or somehow, an Active/Inactive flag that would change evertime an old owner transfers the animal to a new one. The relationship Animal-Old_Owner must be visible in the  Detail View of the Animal, but with a Flag se to Inactive, and the relatioship between Animal-New_Owner must be visible with the Flag se to Active.

Any ideas about how to achive this situation???

Thanks a lot in advance!!

Outcomes