Dynamic Module - Duplicate Entries - ContentLifecycleStatus.Live - Bugs & Issues - Bugs & Issues - Progress Community

Dynamic Module - Duplicate Entries - ContentLifecycleStatus.Live

 Bugs & Issues

Dynamic Module - Duplicate Entries - ContentLifecycleStatus.Live

  • Dynamic Module - Duplicate Entries - ContentLifecycleStatus.Live
  • Hi,

    I developed a custom module "Milestones" with data type "Milestones" and singular  type "Milestone". I'm then using an MVC widget to access the Milestones and display them in chronological order. 

    The code I use to read the items from the database:
    var dynamicModuleManager = DynamicModuleManager.GetManager();
    var milestoneType =       TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Milestones.Milestone");
    var milestones = dynamicModuleManager.GetDataItems(milestoneType).Where(c => c.Status == ContentLifecycleStatus.Live);
    var milestonesSorted = from milestone in milestones
                           orderby milestone.GetValue<decimal>("Year")
                           select milestone;

    I then loop through each item in milestonesSorted, create an object instance, and add it to a list. That list has two items for each entry in the Milestones module. When I display the status on output in the view, both copies of each record show "Live". 

    If I change the ContentLifecycleStatus.Live to ContentLifecycleStatus.Master, I still get duplicate records and the status on all shows "Master". 

    If I comment out the "Where" clause entirely, I get two copies of Live and two copies of Master that are output in the view. 

    In the Content>Milestones section of the Sitefinity backend, I see only the 6 separate items I created. In SQL Server Management studio for the dbo.milestone table, I see 12 entries, and for the dbo.milestone_sf_content_link, I also see 12 entries. 

    I understand that there should be twice as many rows in the table as there are in viewable in the backend because one is stored as Master and one as Live; However, I don't understand why I seem to output twice again that many with duplicates of both Master and Live.

    I have tried unpublishing individual items, which makes no change in their visibility. Deleting items removes them, but once they're re-added, the duplicate problem is unchanged. 


  • Have you tried

    c.Status == ContentLifecycleStatus.Live && c.Visible == true

  • Hi Steve,

    I added that condition into the where clause and it had no effect on the result. 

  • Hello,

    So I decided to delete the Module and try again. I recreated it and that seemed to take care of the problem. Perhaps there was some issue with my database or something... Anyway, it's fixed now.

  • @Stuart i am facing the same issue but recreation it is not fixing my issue??

    any other suggestions?