Wednesday 5 April 2017

Issue with Publishing related items from experience editor

Hello Devs,

We faced one issue while publishing related items from Experience Editor. We are passing a datasource item (e.g. XXX) to a component.

The Datasource item have a multilist field where we select the items (Item: A, B) to be displayed.

When we Update field values of the below selected items (Item: A or B) from the experience editor. The values are updated from the experience editor and were reflected in content editor as well but when we publish with (Publish sub Items and Publish Related Items) the changes are not getting reflected.

Question: Is this an intended behaviour? (We raised a support ticket for it)

Yes, Sitecore does’nt process second level reference and therefore it’s not process by Sitecore. The reason is to prevent huge number of items being published. Sitecore doesn't process references of references.

You can customize your solution to implement the behaviour in the following way:

1. Create your custom processor based on the Sitecore.Publishing.Pipelines.GetItemReferences.AddItemLinkReferences 
one (i.e. copy sources of processor).

2. Modify the GetReferences() method so that it would recursively process reference references if item is being referenced by the Renderings field (i.e. reference is a data source item).

3. Replace predefined processor with your custom one.

Click here to download the custom code file provided by Sitecore.

That’s it !!!

Happy Coding 😊

No comments:

Post a Comment