Friday, 5 June 2015

Lookup column is blank after moving the list as STP file from one environment to another.

Do you know the importance of lookup column in sharepoint list?Its the kind of field in a list which pulls data from another field of a List.Suppose if you have two list called ListA and ListB in your sharepoint web application.You created a field in ListB of type Lookup and lookup data is coming from ListA.

Till now its working fine for you.

Now, you moved these 2 lists (by save as template) from Development environment to Testing or Production.
You found that your data in lookup field of ListB is empty.

The reason here is once you moved the list to new environment the list id will be changed, so in this case ListA id will
be changed and lookup field of ListB will not able to identify the list.

So how to resolve this?

Follow below steps to overcome this problem:

Click on ListA (from Left navigation pane), then go to list setting once you click list setting of ListA,
in address field of browser copy the List id.(see below url)


Now replace %7B with  {
%7D with }
and %2D with -

Once you replace the above code your list id will look like this


So what to do next?

You already have the .stp file of ListB.

rename .stp file of ListB to .cab file. Right click and extract the .cab file.

Open the menifest xml file that appears after extract. Now you have to change the list id of ListA which will be in menifest file of ListB.
(Replace the old list id of ListA with current list id as you formatted the id above).
Save the file.

Then you have to reset to .stp file

Now open visual studio, create a Deployment and installer project->Visual Studio Installer, choose CAB project from the Ok.

Right click on project name in VS, add file that you got when you extracted the cab file. Once you add the file.Build the solution.
Now go to bin folder of your Visual studio project, Debug /or Release Copy your Cab file, paste it to your desire location in any drive.

Right click on file and again rename to .stp file.

Now save this list template to list galley. And create this as ListB.
Your ListB lookup column will now able to identify the List id of ListA and will pull the data in lookup field.

Enjoy SharePoint !

No comments:

Post a Comment