Sitecore Cloning – Part 1

Here we will see something about Sitecore cloning functionality. Sitecore clones are an efficient way to place your items throughout the content tree and then have the content controlled from one central location in the content tree.

It is basically used when you don’t have to sift through a huge content tree just to change a tiny thing to a parent content piece and all its duplicates.

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.

  • It is different from Sitecore copy/duplicate in the following terms:
    • Cloning feature won’t appear after you right click the item on the content tree. It is available in the configure tab.
    • When something is duplicated in Sitecore, it’s made a double of the item, but the duplicated item has no relationship with the parent item.
    • When something is cloned in Sitecore, it’s still making a double of the item, but this time the cloned item receives input from the parent item. If you change pieces of the parent item those changes will reflect in cloned item.
    • If you change a piece of cloned item and then make changes to the parent item, the changes to the parent item will not override the changes to the cloned item, instead a change notification will be displayed on the cloned items when the field value in the original item has been changed.

  1. Review the original item
    • Go back to review the change of original item’s field value
  2. Accept the change
    • Apply the same field value change from original items to the cloned item field, and                the [original value] will be displayed next to the field item
  3. Reject the change
    • keep the existing value on the cloned item and hides the message

This also applies to new sub-items created under the parent item. Notification that will appear in this case is as below:

Notification Update

Just like the other notification, user can accept or reject the changes. In this case if the change is rejected, the sub-item never appears under the cloned item. The entire tree must be re-cloned for the new sub-item to get cloned.

It also applies when you create a new version of parent item. Notification that will appear in this case is as below:

Notification Update

Just like the other notification, user can accept or reject the changes. If you do not update to the new version, the clone stays “linked” with the previous version of the source item. In other words, the clone will inherit field values from the previous version.
If you update to the new version, the __Source field value is updated to point the clone to the new version of the source item. What this means in terms field values is that they will be inherited from the new version.

Below are some questions related to cloning that commonly comes to mind while development:

How to know if an item is cloned or not?
A cloned item has a reference back to the original item, the “Created from” value under the “Quick Info” section.
It will display the referenced original item ID instead of “[Unknown]”

Quick Info

How to know if an item values are original or have been changed?
You can click on a cloned item and see which values are the original value (from the parent) and which values have been changed in the cloned item itself.
It will state [original value] to designate all fields that are same as the parent item.

CloneValue

What will happen after a clone item is published?
Cloned items are nothing but normal sitecore items with a link to its parent item but once an item is published the cloned item becomes real items, and thus the relationship between the items no longer exist on web database [Production Servers].
Note: All changes to cloned items must be individually published and just publishing the parent item does not publish the cloned items.

What happens if I delete the source item?
If clones exist, Sitecore will warn you that deleting the item will cause the item’s clones to become “real” items. A real item is an item that is not a clone.
This is a process called “uncloning”. The field values from the source item are copied into the items that are clones of that item. Uncloning can also be performed without deleting the source item.

What happens if I delete a clone?
With Regards to cloning nothing happens.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s