Try our conversational search powered by Generative AI!

Copy a page property value to another

Vote:
 

Is it possible to copy a page propety value to another? I'd like to copy the StopPublish to a new DateTime called ExpDate. I've looked at the tables in the database but is it poosible to just insert new lines into this one without anything else suffering or breaking?

#71376
May 16, 2013 15:56
Vote:
 

I tried inserting a line into tblProperty but that was not enough. The value is not showing up in edit mode.

#71378
May 16, 2013 16:22
Vote:
 

You could get it to work by inserting values directly to database tables but I would not recommend that (e.g. notice that fkPropertyDefinitionId is not same for different properties).

I would do it through the API by write a small job (e.g. a scheduled job) that recursively traveres the content tree and sets the property value and "resaves" the content, you can use SaveAction.ForceCurrentVersion if you do not want new versions created.

#71423
May 17, 2013 13:13
Vote:
 

Yeah, I guess that's the way to go. I'll just do like you say and write a code and loop them through. Thanks for the input!

#71431
May 17, 2013 15:27
Vote:
 

I would probably solve it by reacting to the publish event and copy if it is not equal already. Careful so that you don't enter an infinite loop though :)

#71442
May 17, 2013 17:55
Vote:
 

My assumption was that the issue was about changing existing pages, if that is not the case then Daniels approach of hooking up to event is better. 

If you always want the property values (StopPublish and ExpDate) to be the same then the suggestion is to mark your ExpDate property with Ignore attribute (then it will not get a backing field in database) and simply implement the getter as returning the value from StopPublish.

#71443
May 17, 2013 20:51
Vote:
 

Sorry for the late reply. I want to also remove the current StopPublish values so a loop seems to be the best way.

#71474
May 20, 2013 15:45
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.