I have been trying to get around a problem that has been troubling me with the Nested Tasks design.
You see, I wanted to put the whole list configuration into a list definition, which is basically an xml file which is easy to maintain. However, since we have a need for a lookup field, it looks like we are going to need to write code (a feature event receiver) to add that field, instead of having it in the list definition.
To define a lookup field, you need to specify at least two things:
- The GUID of the list its connecting to
- The name of the field in the list it connects to
- You may also specify (optional) the type of join and which field to display, so you can potentially connect to the ID field, but display the title field.
My problem is with item number 1 above – we don't have the GUID of the list, and there seems to be no way in the XML to simple tell it "I want you to connect to this list!".
When I was writing the design I was aware of this issue, but I was hoping research will uncover a way to accomplish that. I thought "there must be a built in feature that defines a lookup!", but I was wrong.
So unless any one of my readers knows how to define a lookup field in a list's schema, I will start working on a feature event receiver that will add the field to the list.
Come to think of it – this may actually be better, because now we can create a feature that just changes the existing lists, and not create a new list.
What do you think?