Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Pete 213 posts 285 karma points
    Aug 23, 2012 @ 17:29
    Pete
    0

    Script not finding published doc

    Hey all

    I'm trying to create a document, then create a document underneath it (as in the first or next child). But the script does'nt seem to see that the first document has been saved and published and as such does not want to add a doc under it ( in razor ).

    Document newDoc = Document.MakeNew("A New Comment", DocumentType.GetByAlias("Comments"), umbraco.BusinessLogic.User.GetCurrent(), doc.Id);
    newDoc
    .Save();
    newDoc
    .Publish(umbraco.BusinessLogic.User.GetCurrent());
    umbraco
    .library.UpdateDocumentCache(newDoc.Id);

    if(Model.Children.Where("nodeTypeAlias == \"Comments\"").Where("Visible").Count() > 0){
    Make new document under the 'Comments' doc...
    }
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies