simon
simon

Reputation: 140

Changing Custom site column to lookup

I got thrown in to a situation where the customer has a production enviroment and needs to make some changes without losing data.

One part of the problem is changing a sitecolumn (used in CT, 2-3 lists, and multiple web parts as custom property) from a text field to a lookup.

I have tried to set the schemaxml via powershell and push the changes to the lists. I get errors. I have also tried to update the column in the list with lookup schemaxml. If i remove the sitecolumn and create a new the webparts stop working, since they need the sitecolumn.

What would be the best solution for solving this?

Upvotes: 0

Views: 937

Answers (1)

Vaibhav
Vaibhav

Reputation: 447

@Simon if you try to replace column type from text to lookup, you will lose data for sure.

  1. Create extra single line of text column 'Backup' in the list.
  2. Write powershell script to copy the data from current text column to Backup column.
  3. Change type of column from Text to Lookup.
  4. Use Manual or powershell approach to rewrite data in new column.
  5. Delete temporary backup column.

Upvotes: 1

Related Questions