0
votes

I am mapping Sitecore Items using GlassMapper v5 in Sitecore.

We implemented the following classes with GlassMapper.
However, although the value of the field is acquired for the ItemTemplate item, the value of the Droplist field (CategoryTemplate) created in the ItemTemplate has been returned as NULL and it can not be acquired.

[SitecoreType(TemplateId = "9876...", AutoMap = true)]
public class ItemTemplate
{
    [SitecoreParent]
    public virtual Common Parent { get; set; }

    [SitecoreField(FieldName = "Category", FieldType = SitecoreFieldType.Droplist)]
    public virtual CategoryTemplate Category { get; set; }
}

[SitecoreType(TemplateId = "1234...", AutoMap = true, TemplateName = "CategoryTemplate")]
public class CategoryTemplate
{
    [SitecoreField(FieldName = "Id")]
    public virtual string CategoryId { get; set; }
    [SitecoreField(FieldName = "Name")]
    public virtual string CategoryName { get; set; }
}

Environment information: - Sitecore 9.0.2 - GlassMapper 5.0.6.0

What am I missing, please?

1

1 Answers

0
votes

Try SitecoreFieldType.DropLink. The DropList type stores string value. Your template need to change to droplink too.