Deleted branch causing issues

I've deleted a branch that we will no longer use, and now all items created based on that branch show
[branch no longer exists]-{00000000-0000-0000-0000-000000000000}
in the 'created from' field.

That wouldn't be so much of an issue, but whenever we save an item (or sub-item) created from the branch, there is a popup saying:
The item "Item Name" contains broken links in these fields: The template or branch for this item is missing. Do you want to save anyway?

Does anyone know if there's an easy way to fix this up and get rid of the message? I've tried rebuilding the link databases but that hasn't helped.  I'd rather not have to run a SQL query statement across the items, but if it comes to that I will.

Thanks

  • On the standard values of the item template (or a base template) that is causing the issues you have a field called insert options. In that field you have to remove the reference to the non existing branch.
    If the field insert options is not visible on the standard values make sure that the standardfields checkbox is checked in the ribbon on view tab.
  • In reply to menno Visser:

    Thanks, but the issue isn't with the insert options of the parent item, it's on the tree that's been created from the (now deleted) branch.
    I can't find any broken references on any of the standard fields.
  • Hi,

    MasterId field in SQL database is responsible for 'created from'.

    Review dbo.Items table and you will see it. If your Items were created from branch their fields MasterId have values - branch id (in your case id of branch that was removed). If items were created from template, 'MasterId' field has '00000000-0000-0000-0000-000000000000' value.
    How can you fix it? Here is an answer. Update MasterId field to 00000000-0000-0000-0000-000000000000.

    You can use next query. Be careful, use your own query to find broken items by filter. Here is what I used.

    update [your_db_name_master].[dbo].[Items] set MasterID = '00000000-0000-0000-0000-000000000000' where TemplateID = '5F116F39-6BB4-4AA8-888E-1436C133F758'

    P.S. Clean cache after update.
    /sitecore/admin/cache.aspx

  • Or this one.

    update [your_db_name_master].[dbo].[Items] set MasterID = '00000000-0000-0000-0000-000000000000' where MasterID = '[id of broken branch]'
  • Thanks Vlad, that's certainly the fastest option, and the best option for numerous items, which was the case for us (we had thousands).

    I did end up contacting support as well (they raised a bug), and they also mentioned it was possible to loop through the items and set
    item.BranchId = Sitecore.Data.ID.Parse("{00000000-0000-0000-0000-000000000000}");
    where BranchId is the ID of the branch which was deleted.
    This is pretty much the same, but doing it programatically instead of an SQL statement.

    I've written an aspx script to stick in /sitecore/admin. You just input the root node (that was created from the deleted branch) and it resets it and all children. If anyone wants it in the future just let me know.