.netumbraco

Umbraco Related Links missing after V8 upgrade


I have a problem, after upgrade from Umbraco V7 to V8 my related links are missing. I saw that when im getting the information they are still there in the response, but i can't see them in the dashboard. Before the update the Data Type was "RelatedLinks" and after update the Data Type is "Multi Url Picker"

problem

problem2

picture with created new related link


Solution

  • The Related Links data type changed to Multi Url Picker on Umbraco v8. Your first step should be to check whether your problem is a configuration or data issue.

    To check whether this is a data issue, you can create a new page, using the same document type (and data types). If it is not showing any error, then it must be related to data.

    If it is a data error, then you can try looking for solutions to update or create the data.

    If you don't have many pages that have this problem, you might want to consider manually creating/updating the content pages that have this problem. Another option is to check the database to find out the missing bits and update the data via some scripts.

    Final approach could be to try fixing the data problem by creating a ValueConverter, similar to this one:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Umbraco.Cms.Core.Models.PublishedContent;
    using Umbraco.Cms.Core;
    using Umbraco.Cms.Core.PropertyEditors.ValueConverters;
    using Umbraco.Cms.Core.PublishedCache;
    using Umbraco.Cms.Core.Services;
    using Umbraco.Cms.Core.Web;
    
    namespace AnUmbracoV10ProjectName.Configurator.Core.Util
    {
        public class IntUdiMultiNodeTreePickerValueConverter : MultiNodeTreePickerValueConverter
        {
            private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
    
            public IntUdiMultiNodeTreePickerValueConverter(IPublishedSnapshotAccessor publishedSnapshotAccessor, IUmbracoContextAccessor umbracoContextAccessor, IMemberService memberService) : base(publishedSnapshotAccessor, umbracoContextAccessor, memberService)
            {
                _publishedSnapshotAccessor = publishedSnapshotAccessor;
            }
    
            public override object? ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object? source, bool preview)
            {
                if (source == null)
                {
                    return null;
                }
    
                if (propertyType.EditorAlias.Equals(Umbraco.Cms.Core.Constants.PropertyEditors.Aliases.MultiNodeTreePicker))
                {
                    Udi?[]? nodeIds = source.ToString()?
                        .Split(Umbraco.Cms.Core.Constants.CharArrays.Comma, StringSplitOptions.RemoveEmptyEntries)
                        .Select(ParseUdiOrInt)
                        .ToArray();
                    return nodeIds;
                }
    
                return null;
            }
    
            protected Udi? ParseUdiOrInt(string id)
            {
                if (UdiParser.TryParse(id, out var udi))
                {
                    return udi;
                }
    
                if (Int32.TryParse(id, out var integer))
                {
                    if (_publishedSnapshotAccessor.TryGetPublishedSnapshot(out var publishedSnapshot))
                    {
                        var item = publishedSnapshot?.Media?.GetById(integer);
    
                        if (item is not null)
                        {
                            return new GuidUdi(Umbraco.Cms.Core.Constants.UdiEntityType.Media, item.Key);
                        }
                    }
                }
    
                return null;
            }
        }
    }
    

    enter image description here