Draft DynamicContent items showing up as live
Hi
We have upgraded a site from Sitefinity 6 to 7 and have had an odd issue show up.
Steps to reproduce:
Create a page that pulls out DynamicContent items using the following code
Type typeOfItem = TypeResolutionService.ResolveType(YOUR_CUSTOM_MODULE_TYPE);
var manager = DynamicModuleManager.GetManager();
IQueryable<DynamicContent> items = manager.GetDataItems(typeOfItem).Where(x => x.Status == ContentLifecycleStatus.Live && x.Visible);
Create a custom content item and save it as a draft. It will not show in items when queried.
Publish this custom content item. It will show in items when queried.
Save this custom content item as a draft. The item will still show in items. The item will show in the Sitefinity backend as draft.
Anyone have any ideas what could be happening?
Thanks,
David
Hello David,
This is an expected behavior. Please read the following article: Content Lifecycle.
When you save the item as draft a Master version of the item is created. No Live version is created.
When you publish the item the Master version is updated and a Live version is created for this item.
When you save again the item as a draft the Master version is updated. The Live version is not updated but it still exists. Note that the item's status in the Sitefinity backend is Draft (newer than published) not just Draft. This means that the item still has a Live version but the Live version is not updated with the last changes.
Regards,
Nadezhda Petrova
Telerik