Is it possible 2 or more relationships one-to-many between same modules ?

Hi all,
I have the questions and it is about SuiteCRM philosopy of architecture. Is it possible to realize next relationships between modules?
This is only an idea. Not tested yet.

Goal. To create 2 or more groups of contacts in custom module (or in a general / core module).

Possible solution: create 2 similar relationship with the same modules one-to-many

a) In the module present 2 fields to add contacts.
b) These contacts are splitted in 2 groups and present as lists of contacts in different “panels” below the main module part.

Task description:
Assume the module with 2 groups of contacts is Accounts (or any custom module).

  1. One Contacts module contains all contacts used in the organization
  2. Account (or custom) module has different groups of contacts - Speaker and Visitors for example
  3. Any contact can be a Speaker or a Visitor. It is not possible to use a field in the contact like “Status” or “Type” to define the role in this case.

To do 2 groups with contacts I assume that I can do 2 identical relationships one-to-many between modules Contacts and Accounts (or custom) module.
Contacts will be presented in 2 different panels below the main part in the Accounts (or custom) module.

** I wrote “Accounts (or custom) module” because core modules can have some limitations but custom modules can have no such limits.

Is it possible 2 or more relationships one-to-many between same modules.

Thanks in advance.

Relationships should be independent of each other, even if they point to the same module.

If you can avoid a full relationship and just use a Relate field, it might be simpler for your users.

Also you might prefer a Relationship with fields inside it. For example, two connections to the Contacts module, each with a field specifying a property of the relationship, what kind it is, for example, “mother” and “father” (what one person is to the other). There are tutorials online for this, though i must warn you it’s more complicated. But it’s often the correct design decision.

1 Like

Hi Pgr, thanks for the explanation. I didn’t understand all how to use these ways.
I have new one goal to do :slight_smile:
To be clear I have to say that the task is about events and studies.

  1. What differnce between full relation and Related field technically? Can I read about it somewhere?
  2. “Also you might prefer a Relationship with fields inside it.” What does it mean?

Maybe I understand you incorrect. Also I read in Sugar docs about the Related field. I guess it is not enough for me.
Problem is in unlimited number of guests or visitors. So I can’t just make about 5 fields for speakers and 25 for visitors.

Thus I have to have lists of contacts for each group. Maybe in some sections I have to make more groups.
The test result in the attachment.

However, could you describe in details or send me some links about ways you described in your post?

Thanks, Alex

the relate field is basically storing the remote object’s id as a foreign key in its custom table, meaning that the relationship is only “visible from one side”.

a full relationship is visible on both involved modules.

you can add 1:n or n:m relationships between modules (not just once, but multiple times). each relationship will be handled in different tables and will use individual subpanels.

Sorry I don’t have time now for lengthy explanations… :frowning:

The way you’re doing it seems fine to me. Two subpanels with two different kinds of people, if that’s what you require, it’s ok.

The only thing I would consider is if you don’t prefer re-using an existing module for “people”: you have four kinds: Contacts, Leads, Targets, Users. Each has its specifics, sometimes they might come in handy to you. For example, the ability to convert from Lead to Contact, or the ease of generating campaigns around Targets, or the existing dashlets and reports. When you go with new, custom modules, you’re throwing away existing functionality.