Q: When a document is marked/unmarked for deletion, and this document is a parent of child documents, is there a way to also mark/unmark its children for deletion?
I know I can hook into DatabaseScript:OnDocumentDelete() and delete the documents immediately, but that’s not what my client wants (obviously, because done that way you couldn’t undelete them). Alternatively, I could implement my own “trash” functionality (to support undeletion), but it seems to me that this should be built-in.
Q: Put another way, is there a “softer” alternative to NotesDocument.Delete() which will merely (un)mark a document for deletion rather than deleting it straight away?
In any case, this cannot be the first time anyone’s had need of this; however, I have not been able to find useful resources on the Internet (possibly because it’s rather tricky to search for).
Help?
The functionality is not built in so you would have to create your own mechanism.
The underlying question is whether there is an event to hook into that is triggered when a user unmarks a document for deletion. I don’t believe there is. Perhaps in the C API.
You could alternatively prevent child docs from being deleted if they have a parent by handling the ondocumentdelete event and checking each doc to see if it is a response doc.