I'm currently developing a SharePoint site which I need to set up two many to many relationships.
List1 n <--> n List2 n <--> n List3
Keys for each list are: CID, RID, and PID.
I have an additional two lists which join the lists: ListCID-RID ListPID-RID
These two lists have two columns both of which are lookups. ListCID-RID has a lookup column to List1: CID and List2: RID. ListPID-RID has a lookup column to List2: RID and List3: PID.
With these relations if I manually add data and link it I can generate the appropriate views I need, however I'm having trouble with creating new items.
When a new item is created in List2 the RID is generated by getting a GUID. List1 and List3 items can only be created when you are referring to List2. Basically the RID is passed to the new form for List1/List3 and then the list generates its own GUID.
What I'm having trouble with is finding a way to link the lists.
The options I currently think I have are:
- Hook the form submit button to create the item in ListCID-RID or ListPID-RID. I've seen examples for URL redirecting and would use the same approach.
- Have the form button submit to another aspx page which takes the RID and CID/PID and creates the list item and then redirects. I'm concerned this method would be slow.
- Use a workflow. I'm trying to stay away from workflows.
- Create an event receiver. I don't know where to start with this one or if I'm even able to do it within my environment constraints.
Right now the issue I'm running in to is that ListCID-RID and ListPID-RID only contain lookups, which means that the items must exist in List1, List2 or List3 before they can be connected.