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

Forums / General Discussions / Sitefinity OriginalItemId vs Id

Sitefinity OriginalItemId vs Id

6 posts, 0 answered
  1. Joshua
    Joshua avatar
    4 posts
    Registered:
    07 Feb 2015
    09 Oct 2015
    Link to this post

    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.

  2. Victor
    Victor avatar
    94 posts
    Registered:
    15 Jun 2011
    09 Oct 2015
    Link to this post

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

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

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

     

  3. Joshua
    Joshua avatar
    4 posts
    Registered:
    07 Feb 2015
    09 Oct 2015
    Link to this post

    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.

  4. Victor
    Victor avatar
    94 posts
    Registered:
    15 Jun 2011
    09 Oct 2015
    Link to this post

    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.

     

     

     

  5. Joshua
    Joshua avatar
    4 posts
    Registered:
    07 Feb 2015
    09 Oct 2015 in reply to Victor
    Link to this post

    "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?

  6. Joshua
    Joshua avatar
    4 posts
    Registered:
    07 Feb 2015
    09 Oct 2015 in reply to Joshua
    Link to this post
    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).
6 posts, 0 answered