Copied to clipboard

Flag this post as spam?

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


  • andrew shearer 510 posts 659 karma points
    Oct 19, 2011 @ 02:38
    andrew shearer
    0

    Deleting current document from content tree via API

    I have a situation where I’d like to delete the current document once it meets a certain condition/state. I’ve triggered this check from the before/after publish events but im not having any luck with the UI once I’ve deleted it. It looks like umbraco is trying to update the content tree and/or detail pane after I’ve deleted it, and because it no longer exists it throws a wobbly.

    entryDoc.delete(false);

    when I don’t delete the doument permanently then umbraco doesn’t ‘crash’ but the UI still shows the deleted item in the detail panel.

     

    Can anyone suggest anything or an alternative approach? Is there an API call I could make to show the root or home node? i.e. move to a different part of the content tree from where im deleting the document to avoid the UI problem.

     

    Thanks

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Oct 19, 2011 @ 03:58
    Tom Fulton
    0

    Hi Andrew,

    Have a look into the ClientTools class, it has some javascript API methods that should help you out, namely ChangeContentFrameUrl and/or SyncTree.  See this thread for a simple example.

    -Tom

Please Sign in or register to post replies

Write your reply to:

Draft