Sitefinity OriginalItemId vs Id

Posted by Community Admin on 03-Aug-2018 02:36

Sitefinity OriginalItemId vs Id

All Replies

Posted by Community Admin on 09-Oct-2015 00:00

I have been searching and have yet to find an adequate answer to this.

What is the difference between OriginalItemId and just Id?

Which one points to the record that I need? Whatever the correct/current most recent record is?

I have read something about a master record, and then child records?  If so, what exactly is the master record?  Is it the original unpublished item?  Is it the most recent/current record that I am looking for?

 It seems like this is an important thing to be documented somewhere, and yet I can't find any documentation anywhere on this subject.

Posted by Community Admin on 09-Oct-2015 00:00

While I do have issues with MANY of SF API features poorly documented.

To be fair, they did a good job with this one:

docs.sitefinity.com/for-developers-content-lifecycle

 

Posted by Community Admin on 09-Oct-2015 00:00

This is very useful info that I didn't find.  Thanks.

It doesnt really answer the question as to the nature of OriginalItemId vs. Id though.  The logical thought is that OriginalItemId may refer to the Master version?  But I have seen a lot of code samples querying based on OriginalItemId when trying to get the live version, and just as often I have seen it done with just Id (I am assuming one of these is wrong).  Not all of the code I refer to is from Telerik, but I don't see any documentation or anything (Telerik or not) that confirms exactly what each field is really for.

Posted by Community Admin on 09-Oct-2015 00:00

I hear, even our code isn't always consistent.  What I try to do, use the OriginalContentId everywhere.  For relationships, etc....

Then when querying, use status=live && visible=true && originalcontentid=?

When editing, you query for the master so you use id=? && status=master, check out the master (which creates the temp),make your changes, and then check in the temp, which updates the live.

 There's good example in the module builder documentation that's generated for you when you create the module.

 

 

 

Posted by Community Admin on 09-Oct-2015 00:00

"use status=live && visible=true && originalcontentid=?"

But if originalcontentid refers to the master, wouldnt this always return a result of 0 items?

It would be nice to just know what I am querying here (master, live, a temp item?  Or maybe I am totally on the wrong track..): DynamicContentManager.GetManager().GetDynamicItem(myType, Guid.Parse((string)searchDoc.GetValue("OriginalItemId"))

Which one am I querying?  There is also a searchDoc.GetValue("Id").  Even if I put in a break point, query both, and see the status of each result, is this behavior consistent in areas other than search?

Posted by Community Admin on 09-Oct-2015 00:00

I think I understand that query now.  OriginalContentId does refer to the master.  They all have this field and it points to the master.  Then you ask for the live (of which there should be only one).

This thread is closed