The issue is caused by:
- incorrectly coded custom fields on the Rendering Parameters template.
- the setting
ItemCloning.RelinkClonedSubtree set to
During the cloning process, if
ItemCloning.RelinkClonedSubtree is true, Sitecore runs
ReferenceReplacementJob.Start. This method is primarily intended to update the presentation details of the clone to point to newly-cloned relative datasources of the clone. Essentially,
if the source item links to an item (like a child datasource) and the
linked item was cloned as part of the cloning process, it relinks the
linked item to the new clone parent via updating the Presentation Details.
As part of this process, however, it parses the rendering parameters and attempts to cast each field to the type
Sitecore.Data.Fields.CustomField. If it fails, the Rendering Parameter value is not added to the clone.
The solution, therefore, is to ensure any custom Content Editor fields inherit from the
CustomField class and can thus be cast properly.
public class MyCustomTextField : CustomField
// My implementation
Interestingly, many guides do not stress the importance of inheriting this class when building a custom field- even Sitecore's own documentation does not mention this.
On top of that, the out-of-the-box
Integer field does not inherit the
CustomField class and is susceptible to the same behavior.
This issue is not present in Sitecore 9. The
ReferenceReplacementJob piece was replaced by a pipeline and was likely refactored to account for this.