Showing posts with label List Template Look Up Field problem. Show all posts
Showing posts with label List Template Look Up Field problem. Show all posts

Wednesday, June 15, 2011

Sharepoint LookUp field issue when created using List Template


Usually when we create a list using a "List Template". The lookup field doesnot take the reference. The blog will show you how to reproduce the issue and resolve it.


How to produce this issue.



  • We have created 2 lists "Gender" and "Actors". Gender is going to be a lookup field in actors. After filling some data both the list will look like shown below.



  • Save both list as a template with the content included. In this current example, i have given the names as "Template Gender" and "Tempate Actors".

  • Download the stp files from the Site Settings > List Templates.

    • Create another site. Upload the tempates Site Settings > List Templates.

    • If you don't want to create another site than delete both list from current site.



  • Once the template gets added. Use the template to create a list. In the below given images "Gender" List comes up fine but "Actors" List is not having anything in the "Gender" column field.


Solution



  • Download the "Template-Actors.stp" file from "List Templates".

  • Rename the file and change the extension of the file from ".stp" to ".cab".

  • Once you have the extension as ".cab", extract the "Manifast.xml" file.

  • Get the List ID of newly created "Gender".

  • Replace the old value List Id in Lookup of Gender to New List ID

    • Old

    • New



  • After making the changes save the xml file.

  • To recreate a CAB file open "Microsoft Visual Studio". Create a "CAB Project". In this case i have created "Template-Actors".(We can also use makecab.exe instead of visual studio.)

  • Add the file Manifast.xml to the project.

  • Build the cab project. Go to debug\bin folder you will find "Template-Actors.cab".

  • Rename the file to "Template-Actors.stp".

  • Upload the file to "List Template".

  • Create a list using new template.

  • The gender selections will now show up.