Custom module relationships

Hello all

I am new in SuiteCRM world and I have a question.

I have created a custom module Site with one relationship to Account, also I have added a field ‘related_account’ of type Relate to link the site to an Account.

When I create a new Site, if I select an account in ‘related_account’ field no entry is added to the join table:

MariaDB [suitecrm]> select * from plt_sites_accounts_c ;
| id | date_modified | deleted | plt_sites_accountsplt_sites_ida | plt_sites_accountsaccounts_idb |
Empty

So I cannot see the new Site in Account’s subpanel. Do I have to do something else to do that ? I am lost, I don’t find any documentation.

Thank you very much.

Hello,

What I understood is that you have created a relationship and also the field type of relate. and you are trying to relate field, Definitely, it will not add value in the relationship table, as relate type field and relationship both are different.
When you create a relationship, for example, one to many. In module (one) you will have related field and other side you will have subpanel(many)

1 Like

Thank you for your help urdhvatech

So if I understand well in many-to-many relationship it is not possible to add a new entry in the relationship table when a value is added to the relate field I have created.

Can you tell me how contacts and accounts works ? When I create a new contact I always link it to an account with the relate field in the edit form and then I can see the contact in the account’s subpanel, this is also a many-to-many relation ? How it is possible ?

Thank you very much

Hi I Have Created a custom module base on the case module copied the relationships .

All works ok but when I create a new “Billing Ticket” ( New Case) from the Contacts screen it relates the contact but not the account , When I use the standard case module it works fine how can I get my custom module to behave the same . see attach images