labels on many to many relationships

I’d like to create a many to many relationship between accounts and contacts, so I can indicate for any organisation which contact is the buyer, or accounts or purchasing etc. I can see how to add the relationship, but there seems no way to add a label to the relation itself. ie contact A is the buyer for account B. Contact C is the accounts person for account B etc.

is there a way to do that?

I haven’t tried it mysel but I think this artice should put you in the right direction:

http://developer.sugarcrm.com/2011/10/04/adding-fields-to-a-relationshipsubpanel/

so if I understand correctly, that approach involves modifying the source? I’d rather not take that approach as I don’t want have to manage my own patches on top of the original source.

is there a way to build a separate plugin or module to do this?

I re-read your requirement and, possibly you can achieve this by just adding a custom field in the contacts module.

If you want to select the role from a fixed dropdown, you should proceed as follows:

  1. login as administrator
  2. Go to admin->Developer Tools section->Dropdown Editor
  3. Once in the dropdown editor click on Add Dropdown button, give your new dropdown a name, add all the items, order them as you wish (you can drag them or click on sort). When done save
  4. Go to Admin->Developer Tools section->Studio
  5. On the left side navigate into the Contacts module and
  6. Fields->Add Fields
  7. Select the type dropdown, give a name and a label to the field, then from the dropdown that appears after you have selected the type, pick the name of the list you just created. When finished click on save
  8. Still remaining in the Contacts module section within Studio, select Layouts->EditView
  9. drag an empty row from the left to the right and position it to the right where you want the field to appear in your form. When done click on Save and Deploy
  10. Repeat the same as the previous point for DetailView and, possibly for other views (ListView and or search views, etc.) clicking Save and Deploy when finished

This isn’t exactly what you asked for but, assuming that a Contact stays within an account, and has a stable role, it should cater for your need

Additionally, within an opportunity you can assign a role for that specific opportunity for a single contact (from within the opportunity you can add contacts by selecting/creating them from the contacts subpanel and when you click on edit for a specific contact by clicking on the rightmost button of each contact you are taken to a form to assign a role specific to that very opportunity. (in case these roles do not suit you you can edit them in the dropdown editor)

ah, yeah that;s a good idea. I’ll give that a go, thanks.