wiliammbr's blog

Some thoughts on SharePoint and other random stuff

Recovering corrupted Lookup Columns

Sometimes we need to transfer a list from a Production environment to a Development environment, just to reproduce some bug or situation with real data. It can achieve by the Save as Template feature, exporting it from an environment to another and then recreating the list.

But, if you have Lookup fields it can give you some headaches. As soon as the list is restored in the other environment, the Internal Guids are changed an any connection to the source list of the lookup column will be lost:

The option Get information from will be empty and the column name will be a span, not a a dropdown. where you could select which field should be presented:

The list forms will show this message: One or more fields are not installed properly. Go to the list settings page to delete these fields.

So… what can we do? SharePoint says that we need to delete the field and recreate it. But that is not a good approach, because you are going to lose all the data!

Hopefully, the link was lost but the data didn’t. The lookup column still holds the Lookup Ids in the list. You can solve this by running the script below to recover the Lookup Column and keep everything working fine. Just after the script runs you will see the Lookup column working as expected.

I hope this snnipet can help you.
As always, thanks for reading!

References:
I Like SharePoint

1 Comment

  1. Great tip. Thank you for share. 😉

Comments are closed.

© 2017 wiliammbr's blog

Theme by Anders NorenUp ↑