+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Determining Identifier Field For Dynamic Module Type

Determining Identifier Field For Dynamic Module Type

2 posts, 1 answered
  1. Michael
    Michael avatar
    2 posts
    Registered:
    23 Oct 2015
    23 Oct 2015
    Link to this post

    Hi,

    I'm trying to find the field specified as the identifier for a content type using ModuleBuilderManager but can't figure it out. I thought there would be a flag on DynamicModuleField to indicate it but I can't find it.

     

    Thank you.

     

    Michael

  2. Michael
    Michael avatar
    2 posts
    Registered:
    23 Oct 2015
    26 Oct 2015
    Link to this post

    Figured it out.

    var mbm = ModuleBuilderManager.GetManager();
    var mtype = mbm.Provider.GetDynamicModuleTypes().Where(t => t.TypeName.EndsWith("[CONTENT ITEM NAME]")).FirstOrDefault();
    var identifier = mtype == null ? String.Empty : mtype.MainShortTextFieldName;

     

    Thank me!

    Answered
2 posts, 1 answered