1

We are upgrading our Sitecore instance from Sitecore 8.2 version to Sitecore 10.2 version, ORM used in Sitecore 8.2 is GlassMapper(v4.3.4.197). We have upgraded glass mapper in Sitecore 10.2 via NuGet package manager. In Sitecore 8.2 there was a custom field called Linked List which is working fine with Glass Mapper, but after upgrading to Sitecore 10.2, this field is showing an error while mapping.

The current site utilizes a custom link list field as instructed in the URL: http://code.monoco.se/2012/12/a-shiny-new-field-type-linklist/

Model class for glass mapper:

public partial class Footer : GlassBase
    {                            
      [SitecoreField(IFooterConstants.LinksFieldName)]
      public virtual IEnumerable<Link> Links { get; set; }  
    }

View File for rendering file:

 @foreach (var link in Model.Links)
                {
                    <li>
                        @Html.Glass().RenderLink(link, x => x)
                    </li>
                }

Post upgrading the glass mapper. we are getting the below exception for the link list field.

Glass.Mapper.MapperException: 'Failed to map field {51227AF0-F7B9-4930-8CF5-A4055FA69642} with value 
<links><link text="About us" anchor="" linktype="internal" class="" title="About Us" target="" querystring="" 
id="{B6B3EA62-37F4-4EB1-AD3B-33DEAFCFDCBA}" /><link text="Corporate responsibility" anchor="" linktype="internal" class="" 
title="Corporate Responsibility" target="" querystring="" id="{AC469CBD-143E-458B-BFA9-10532835CCDD}" />
<link text="Diversity, equity and inclusion" anchor="" linktype="internal" class="" title="" target="" querystring="" 
id="{0C437528-7C87-4F49-BEE1-4514A9A450BF}" /><links>

enter image description here

3
  • How is this mapped on your model class?
    – Maarten
    Nov 2, 2022 at 11:37
  • @Maarten, I have updated the question with the glass mapping code. Nov 2, 2022 at 13:06
  • I think you should decompile the DLL in the package for this field, add the code to your solution and debug it to find the root cause. It may need refactoring based on latest version.
    – Ghanendra
    Nov 3, 2022 at 15:53

2 Answers 2

3

In Sitecore 8.2, there was a custom LinkList DataHandler that was registered in GlassMapperScCustom.cs file.

  dependencyResolver.DataMapperFactory.Insert(0, () => new LinkListDataHandler());

We added the same in the Sitecore 10.2 instance and it worked.

1

I think Custom Link field you created is associated with a custom class, and code in that class is not compatible with the upgraded version of Sitecore

You can try below things

  1. Check after upgrade your custom field is showing into your Sitecore upgraded version. You can compare it with your old Sitecore instance before upgrade, we generally create that kind of field in Core DB.

  2. Update code in custom field class to make it compatible with new version.

Hope this help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.