Results 1 to 6 of 6

Thread: Can relationships have attributes/fields?

  1. #1
    davideps is offline Member
    Join Date
    May 2011
    Posts
    15

    Default Can relationships have attributes/fields?

    Hello,

    Can relationships have attributes/fields? For example, I would like a place to describe the details of each instance of a relationship. I think this would correspond to an additional column in a database association table (many-to-many). Is there a way to create such fields either through Studio or manually in a MYSQL admin program but have them displayed and edited in SugarCRM panels & subpanels?

    I am using Community Edition 6.1.4 & Ubuntu 10.04.

    thank you,
    -david
    Last edited by davideps; 2011-05-07 at 06:09 PM.

  2. #2
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Can relationships have attributes/fields?

    Out of the box you can't. But with some code you can. See the Contacts-Opportunities relationship for an example. You can edit and set the opportunity role on that relationship.

  3. #3
    davideps is offline Member
    Join Date
    May 2011
    Posts
    15

    Default Re: Can relationships have attributes/fields?

    thanks. as a fix for right now, I may create a separate field in notes for each relationship type and display it in the subpanel of that relationship. It is not a good solution, but may solve the immediate problem. Attributes on relationships seem like they would be useful in a great number of situations. I'm surprised it isn't standard out of the box.

    -david

  4. #4
    bkilgore is offline Sugar Team Member
    Join Date
    May 2006
    Posts
    4

    Default Re: Can relationships have attributes/fields?

    Coincidentally, we attempted to tackle this during a recent code sprint at Sugar to enable this functionality as a Studio add-on, but found some limitations in our Link.php file that was preventing us from adding multiple properties to the relationship. We are looking to resolve this in an upcoming release, but for the time being, you can build it yourself, modeling it after the Contacts->Opportunity relationship, as Eggsurplus suggested. Alternatively, our partner Epicom has implemented a "workaround" solution by creating a custom module to store the properties, and then joining on that custom module. I'll email them and see if they can reply to this thread and provide more info.

  5. #5
    davideps is offline Member
    Join Date
    May 2011
    Posts
    15

    Default Re: Can relationships have attributes/fields?

    thank you. I look forward to hearing more about how people have found ways to add attributes to relationships.

    -david

  6. #6
    edub is offline Sugar Community Member
    Join Date
    Jun 2008
    Posts
    55

    Default Re: Can relationships have attributes/fields?

    What we do is create a module in the middle to store the attributes and then we do some fancy codework to hide the fact that there is that middle module and make the UI more like the opps/contacts relationships (but actually a little more slick).

    So if you wanted to store relationship attributes between contacts and quotes, then you would create a custom module called ContactsQuotes or something like that and then make a one to many relationships from it to the contacts module and another to the quotes module. Then create custom fields for all of your attributes that you want to store.

    This ends up being a workable solution and you can do it all through studio and modify subpanels and all. The custom module is laid out much like you have for many-to-many relationships in Sugar.

    What we then do via code is adjust that subpanel so that you set the attributes when you link two records instead of building the linkage and then editing the relationship to specify the attributes.

    Give us a call if you want help with this. 512-481-9000
    Eric Wikman
    Sr Software Engineer
    Epicom

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Custom fields for relationships
    By blackMumba in forum Developer Help
    Replies: 0
    Last Post: 2011-04-18, 01:05 PM
  2. 6.0: Relate fields versus Relationships? Any Difference?
    By jmarlett in forum Developer Help
    Replies: 1
    Last Post: 2010-10-20, 12:53 PM
  3. Replies: 2
    Last Post: 2010-03-25, 09:39 AM
  4. Want custom link fields to create relationships
    By evilolive in forum Developer Help
    Replies: 2
    Last Post: 2008-03-27, 01:42 PM
  5. custom data fields in relationships
    By adamderesz in forum Help
    Replies: 0
    Last Post: 2007-02-06, 09:48 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •