"The template or branch for this item is missing" window message pops up after saving items


Description

An item might contain a broken link after the removal of the branch template the item was created from. This results in the following pop-up message when saving the item:

The item "contact" contains broken links in these fields:
Originator
The template or branch for this item is missing.
Do you want to save anyway?

Solution

To resolve the issue, for Sitecore XP 8.2.5 download and install the patch compatible with the affected product version found on this page: https://github.com/sitecoresupport/Sitecore.Support.91121/releases.

Alternatively:

  1. Back up your Master database.
  2. Run the following SQL script for the master database:
    UPDATE[your_db_name_master].[dbo].[Items]
    SET MasterID = '00000000-0000-0000-0000-000000000000'
    WHERETemplateID = [Problematic Template ID for which the branch was deleted]
  3. Rebuild the link databases via the Rebuild Link Databases tool in the Control Panel.
  4. Clean cache after updating in the /sitecore/admin/cache.aspx file.