Try our conversational search powered by Generative AI!

Copying (migrating) a field to another

Vote:
 

Hi,

I have a change in my page/block type and I want to migrate the data in the old field to the new one. How to do it?

To elaborate more, before I had a ContentReference field on my page and now I found out that I need a list, but I cannot go and update every page in the production environment. 

First I thought I might be able to do it using default values, but then I've remembered that those values will only update the field on page creation.

Then I thouht of my implementation of IInitializableModule, but how can I access all my pages from here? And is it even a valid approach?

#183776
Edited, Oct 23, 2017 11:33
Vote:
 

what about `MigrationStep`? Can that solve your prob?

#183873
Oct 24, 2017 9:01
Vote:
 

Valdis, You're referring to this feature, right?

https://world.episerver.com/documentation/developer-guides/CMS/Content/Refactoring-content-type-classes/

#183930
Oct 24, 2017 17:29
Vote:
 

Yes

#183931
Oct 24, 2017 17:36
Vote:
 

Hi Ashkan. I these kind of situation a ususllay create a scheduled job that takes care of the content migration. If everything works you only run the job once, and then remove it again.
In it's simplest form the scheduled job could loop through all pages of the affected page type and update those page. If your site has a lot of pages that approach might take too long though...

#184197
Oct 25, 2017 21:23
Vote:
 

@bob and @Valdis,

Thanks guys for guidance. Unfortunatly I cannot use migration steps becase the property is a block type and in migration steps "The previous or new property type cannot be a block." :(

@Erik thanks for the response. I will try that :) thanks

#184411
Oct 26, 2017 10:17
Vote:
 

Thanks Erik, that works fine :)

#184414
Oct 26, 2017 10:53
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.