This is something that is killing SharePoint developers everywhere. Lookup fields just don’t work in list definitions. Well, actually they do.  A lookup field should specify a value for the List property and ShowField property. The first common error is that we usually pass the ID of the list as a List property value. This is not the case. What the definition expects here is the relative URL to the list e.g. Lists/Announcements. Then the ShowField must be the internal name of the field we want to populate.

 

  The lookup will only work if the list you are pointing at already exists so make sure that it is created before the list with the lookup field. One way of doing this is by using the ListInstance element in your feature’s elements and declaring the "parent" list first.

Advertisements