Skip to main content

Microsoft

Sitecore 8 Branch IDs info is lost when Installed from a Package

I have been working in a Sitecore environment where in code, I am checking the branch template ID of an item when searching for those items using Coveo.  Once I completed my unit testing of this functionality in my local development environment, to move things along, I created a package of these items to install on the shared development environment for integration testing purposes.
After I properly published these items, the component which searches for the items based on the branch template was not finding any of these items.  I tried re-building the index and flushing caches to fix the problem.  At this point nothing worked.
Branch Template GUID
When a branch template is created, just like any item in Sitecore, receives a GUID to uniquely identify it (as demonstrated in the image below).
Awards List Branch Template
When an item is created from that branch template, the item receives a BranchID property to connect that item to the branch template which was used to pass its base template to the created item.  Where this value can be seen within this item in the content editor is through the Created from field in the Quick Info section of that item.  The base template at the top of the branch structure which is actually used to create the item is still referenced in the Template field.  An example of this reference within an item based on the above branch template is shown below.
Awards Branch Template Reference
So What Happened ?
There was a situation where my local development environment needed some content items from the production environment taking advantage of the same search capability against a specific branch template ID.  The situation occurred again but this time the indexed version of the item can be examined using Coveo’s CES Administration Tool.  Upon close examination, the branch ID value which the code depends on to select that item was all zeroes instead of the Sitecore GUID assigned to the branch template when it is first created.
If the same item is examined in the content editor, the Created from field no longer contains a reference to the branch template used to originally create it in its original environment.  With that being the case, the search algorithm meant to identify that item through its branch template connection would no longer work.
Removed Branch Template reference
So in Summary…
It was clear that the branch Guid reference of an item does not get copied over from the original environment where it was created to the destination environment where the new items would be created, even if the same branch id template exists in the destination environment.  This information is lost when a Sitecore package is used to install the items onto that destination environment.  As a result, the content has to be recreated within that specific environment in much the same way the original set of items were created without the benefit of using packages to speed up the process of creating those items.  If it is many items, perhaps writing a piece of code to update the branch id property will be a better option instead of recreating a large number of items, one item at a time.

Thoughts on “Sitecore 8 Branch IDs info is lost when Installed from a Package”

  1. Assuming this only happens with Sitecore packages, possibly use glass or TDS to move the items between environments?

  2. Carlos Rodriguez

    or Unicorn… that would be my suggestion. Losing the branch template information when I installed a package caught me by surprise, in the future I will try a TDS or something like that… good suggestion! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Carlos Rodriguez

More from this Author

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram