Menu

SuietASSURED Banner

Save

Save

Welcome, Guest
Username: Password: Remember me

TOPIC: Many-to-one relationship not allowing to use the same related value twice

Many-to-one relationship not allowing to use the same related value twice 4 days 18 hours ago #56797

  • chiwchy
  • chiwchy's Avatar
  • Offline
  • New Member
  • Posts: 3
  • Karma: 0
I have customModule1 and customModule2 and I need a many-to-many relationship between them, with some additional fields. I chose to work around it, so I created customModule3 and added two relationships to it:

customModule3:customModule1 many-to-one
customModule3:customModule2 many-to-one

I have added some fields and it was fine until I started creating records for customModule3.

For example, if I want to create customModule3 record that has value1 for customModule1 and value2 from customModule2, I can't if there already exists customModule3 records that has value1 for customModule1. If I change my relationships to one-to-many, then I don't have the related fields in the layouts.

How do I get this to work?
The administrator has disabled public write access.

Many-to-one relationship not allowing to use the same related value twice 4 days 13 hours ago #56804

  • pgr
  • pgr's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 3150
  • Thank you received: 509
  • Karma: 119
It's a bit hard to get this working, but wouldn't be better to add the fields to the relationship table itself, avoiding the third module?

sugarmods.co.uk/how-to-add-custom-fields...l-sugarcrm-suitecrm/
The administrator has disabled public write access.

Many-to-one relationship not allowing to use the same related value twice 4 days 10 hours ago #56807

  • chiwchy
  • chiwchy's Avatar
  • Offline
  • New Member
  • Posts: 3
  • Karma: 0
How do I do that? I read somewhere on this forum that you can't, that's why I did this. I know that usually many-to-many relationships are tables on their own.

By the way, I deleted this module and redid everything and now it's ok. I guess it was some kind of bug...
The administrator has disabled public write access.

Many-to-one relationship not allowing to use the same related value twice 3 days 20 hours ago #56816

  • pgr
  • pgr's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 3150
  • Thank you received: 509
  • Karma: 119
Yes, relationships have their own table, the question in that article is when you need to add fields to that relationship table.

Studio can't do that, but it's a common scenario in database design - every time some field is a property of the relationship, not of any of the two related records.

For example, I created a relationship between Contacts and Contacts to describe families and other work relationships in a school. In that relationship I had an extra field saying what these two people are to each other (Father, Mother, Tutor, etc). That's a property of the relationship.

Ok, but maybe you don't need that, if you have things working well already. :-)
The administrator has disabled public write access.
The following user(s) said Thank You: chiwchy
Time to create page: 0.048 seconds
Powered by Kunena Forum