This blog post describes cloning, a new feature in version 6.4 of Sitecore's ASP.NET web CMS. For more information about Sitecore CMS 6.4, see my previous blog post, Sitecore 6.4 Features.
Sitecore 6.4 introduces cloning, which creates a dynamic duplicate of an item or branch, and provides notification when cloned items change. You can expect information about clones to appear in the guide to Reusing and Sharing Data.
A clone is an item based on the data template associated with the cloned item. Rather than inheriting values directly from standard values, clones inherit field values from the cloned item. In clones, Sitecore uses the __Source field in the Advanced section of the standard template to specify the cloned item.
Cloned items do not inherit the following fields defined in the standard template:
When you create a clone, under the new item, Sitecore creates clones for each of the descendants of the new item.
You can create clones of items or entire branches of the content tree. You can override individual values in cloned items.
After you update a cloned item, add a descendant to a cloned item, add a new version to a cloned item, or delete a version of a cloned item, the Content Editor displays notifications in the clones regarding those changes, and provides commands that let the user resolve the change.
If you create a clone of a clone, the second clone inherits values from the first clone, then from the cloned item, and then through the standard values chain.
To clone an item, in the Content Editor, select the item to clone, click the Configure tab, and then in the Clones group, click Clone. In the dialog that appears, select the item under which to create the clone.
To convert a clone into an item, copying field values from the cloned item, in the Content Editor, select the item, click the Configure tab, and then in the Clones group, click Unclone.
When you delete a cloned item, Sitecore confirms that it should copy field values from the cloned item to its clone before deleting the cloned item.
To view information about clones in the Quick Action bar to the left of the content tree in the Content Editor, right-click the Quick Action Bar, and then click Cloned Items.
In clones, the text [original value] appears in the title of fields that do not override the cloned value.
Publishing converts cloned data to field values.
The Sitecore 6.4 UI does not support cross-database clones, but this seems inevitable.
The current UI always includes descendants when cloning an item, but change there seems inevitable as well.
When you change the data template for a clone or cloned item, fields with the same IDs will maintain values, but fields with different IDs will lose values, even if they have the same names.
Of course for now you can override everything to do exactly what you need, but you can also expect Sitecore to add the most requested features. For example, Sitecore could introduce rules to manage change notification.
Please add any information or questions about clones by commenting on this post.
Have you thought about if clones should have the header tag for duplicated content automatically?
> the Content Editor displays notifications in the clones regarding those changes, and provides commands that let the user resolve the change. Is there any intention to add functionality to automatically update unlocked clones if you save a change on a cloned item? As much as I've come to dislike proxies, this seems to be a more labor-intensive way to keep your data in sync if you rely on them heavily.
@Kasper Pagels: If you mean that presentation should include specific meta headers, I haven't developed anything. It seems that you could use a pipeline processor, or a presentation component. I wonder if there are cases where one would not want this header in cloned items.
@K.Adam White: When you change a field in a cloned item, Sitecore automatically applies that change to fields in clones that do not override the value in the cloned item. Do you mean that if the item is unlocked, Sitecore should not notify the user about the change?
> "When you change a field in a cloned item, Sitecore automatically applies that change to fields in clones that do not override the value in the cloned item." No, this answers my question; I had misunderstood, and thought the update had to be manually enacted even if you had not overridden the value. Thank you for the clarification, I am excited for this functionality upgrade.
Worth noting that though "When you change a field in a cloned item, Sitecore automatically applies that change to fields in clones that do not override the value in the cloned item." this change won't be in effect on the web until the clone is published.
Some relevant links: www.sitecore.net/.../Cloning-What-Ifs.aspx sdn.sitecore.net/.../ShowPost.aspx adeneys.wordpress.com/.../
6.5.0 Update-4 (rev. 120427) introduces the ItemCloning.NonInheritedFields setting, which specifies the fields that clones do not inherit.
If i am looking in the admin/dbbrowser (masterdatabase) i see that a cloned item got the source property filled in. But when i navigate to the same clone in the web database i see that the clone(item) has no source field filled in .. Is that what you say by Clone items does not support cross-database clones, but this seems inevitable. I wanted to set a canonical tag when a visitor requests a cloned item. Do you have any ideas how to do that?
Hello @Menno, This is a different issue: when you publish a clone to a target database, Sitecore converts that item into an actual item; it is no longer a clone. I don't remember the exact reason for this. I think one solution may be to intercept item publishing and set a checkbox in the item or otherwise indicate it is a clone. Someone seems to have tried this: sdn.sitecore.net/.../ShowPost.aspx One thing to beware of with this is that you probably don't want Sitecore to update the revision ID or trigger events for the items that you update. I don't know if the code shown addresses those issues (maybe it only updates an in-memory representation of the item before writing it to the database, which I think would address the issue). If you end up using EditContext() for this, pass false as the second and third arguments to its constructor (see sdn.sitecore.net/.../ShowPost.aspx for a little more detail on that). There *might* be another way to check for a cloned item in a publishing target database; it might be worthwhile to contact http://support.sitecore.net. Whatever you do, please comment further on this blog post to describe your solution. Regards, -John
Hi John, Is there any solution for the below issue ? i just posted from your blog only "i see that a cloned item got the source property filled in. But when i navigate to the same clone in the web database i see that the clone(item) has no source field filled in" I'm exactly facing the same issue in my server , I have CD and CA servers and i'm using cloning through work flow .all of a sudden links are missing from cloned items ...is there any solution for this Thanks in advance
Cloning looks a good new feature. When I edit a field in a clone, I notice that the [OriginalValue] tag disappears as I would expect. However once this has been done, is there any way to re-establish the link for that field to the parent item, or is the link lost forever.
@Justin: I thought you just reset field values in the clone to their values in the cloned item as you would reset fields to their standard values for any non-clone item (the Reset command in the Fields group on the Versions tab, the Reset command in the Layout group on the Presentation tab, the Reset command in the Insert Options group on the Configure tab, and possibly other specific commands (I can imagine one on the Security tab)). If that is the case, then clones always inherit values from cloned items; the only way to reset a field in a clone to the standard value defined in the data template for that clone would be to reset that field in the clone AND the cloned item (you could also copy the standard value into the clone). Regards, -John
When you create a new subitem for an item that has been clones, it seems you have to manually go to each clone and accept that a subitem be created beneath the clone. Is there any way to not have to do this? For a new solution we will have several clones of one source and the customer won't want to go to every single clone and accept a subitem. It would be much easier and user friendly to have subitems always appear in the clones without any questions. The same also applies to instances where content authors has overridden a value in a clone, then a "power author" changes a value in the source item. How can this change be applied to all clones without the clones having to manually accept the change? Cheers
@Glenn: I know there has been internal discussion about this but I don't have details about any progress. You might contact customer service/support and see if they have ideas, but I will run this by an engineer I know worked on clones. I think there might also be some SDN forum threads about this but they might not be easy to find and would not necessarily have a great answer.