OriginalContentId can be and Empty Guid??

Posted by Community Admin on 05-Aug-2018 12:32

OriginalContentId can be and Empty Guid??

All Replies

Posted by Community Admin on 24-May-2013 00:00

I have a randomizer that gets all products, picks one, then returns it, and stores the OriginalContentId in a table....which is then retrieved later with GetProduct.

So...I find the item, and store it, but the problem is 

1) The OriginalContentId is == Guid.Empty
2) GetProduct throws an exception that you can't give it an empty Guid

??

Posted by Community Admin on 28-May-2013 00:00

Hi Steve,

 OriginalContentId holds the linkage between item's lifecycle versions (Live, Temp objects linked to Master one).

If OriginalContentId is Guid.Empty, that means that the item is in Master status.
If OriginalContentId has a non empty Guid value, this means that there is another item (Master), which Id is equal to the OriginalContentId value.

You can add filtration to your randomizer by Status.

Let me know if this helps you resolve the problem.

Regards,
Boyko Nistorov
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 01-Jun-2013 00:00

I'm confused...no these products are *ALL* published and live...

They're showing up in the webservice and everything

Posted by Community Admin on 03-Jun-2013 00:00

Hi Steve,

 Although all the products are published and live, they will still have a master version of the item, which means you will have items with OriginalContentId == Guid.Empty as many as you have actual items (live + draft). 
Make sure that you check the for ContentLyfecycle.Live and  for Visible == true in the query. Following is an example:

var products = dynamicModuleManager.GetDataItems(carType).Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible == true);
You can find out more about the sitefinity content life cycle if you follow this link.  
Do not hesitate to write us if any other issue arises.

Regards,
Ivan Eftimov
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 03-Jun-2013 00:00

Yeah, I'm familiar with the lifecycle...but the OriginalConentId is the never changing ID that exists on the master, live, and draft items right...the one id that always lets you get to the item.

So now with eComm, thats a guid.empty for me on a ton of products, and you can't even call GetProduct i believe because it throws a can't query with guid.empty exception.

So like if I store a link to the ID of a live item...then go change that item such that it goes through another publish cycle...the Live ID changes....right?  So that ID I have stored returns nothing...which is why we have the OriginalcontentID (I thought)

Posted by Community Admin on 04-Jun-2013 00:00

Hi Steve,

 OriginalContentId is actually the Id of the master item. It is the connection of live and temp items with the master item. So, live and temp items have OriginalcontentId == Id of the master item. 
Master item, on the other hand, has an OriginalContentId == Guid.Empty, i.e. them master item is the actual original content.

Moreover, the Id of the live item does not change if it goes through another publish cycle.

About your case, I suggest you to get the live items and store their Id instead of the OriginalContentId. Later you can retrieve these items by that Id. 

If this does not help, please send your code so we can inspect it in details and figure out the best approach of the problem.

Regards,
Ivan Eftimov
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed