Hello Danny,
Which version of sugar are you trying to implement this in?
I wanted to point out that the new relationships editor in 5.1beta1 allows you to implement exactly what you want, without writing any code

Here's how you would obtain the desired functionality:
1. go to Admin->Studio
2. Go to the Projects Module -> Relationships ->Add Relationship
3. Select 'One to Many' from the Type drop down and ‘Documents’ from the related module drop down and choose 'Default' Subpanel from Documents.
4. Click deploy.
Go to your projects module and voila! you now have a Documents subpanel. You can link as many documents as you want to a given project.
At the same, if you go to create a document, you will notice a Projects select box which allows you to link a document to a project.
In addition, if you need a customized Documents module, you can build one using Module Builder (choose the file type module as the new module type) .
Let me know if you need any further help with any of this.
Thanks
Navjeet
Bookmarks