0

After upgrading to Sitecore 9.3 and GlassMapper 5+ the TemplateId and TemplateName are coming back as nulls. The item is retrieved using MvcCurrentContext.GetContextItem

TemplateId: {00000000-0000-0000-0000-000000000000}
TemplateName: null

The item model is generated as follows. Are there new settings for 5?

[SitecoreType(TemplateId=TestPage_PageConstants.TemplateIdString )]
2
  • 1
    Is you property virtual?
    – Marek Musielak
    Commented Sep 25, 2020 at 17:06
  • Found when adding virtual to the template defintion it worked. Now I just need to change that so it generates correctly.
    – RReilley
    Commented Sep 25, 2020 at 19:53

1 Answer 1

3

Make sure your property is Virtual, we faced the same issue in Sitecore 9.3, after adding virtual it resolved for us. eg -

public virtual string Title { get; set; }
1
  • Found when adding virtual to the template defintion it worked. Now I just need to change that so it generates correctly.
    – RReilley
    Commented Sep 25, 2020 at 19:53

Your Answer

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

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