I need to delete some “child” documents when a “main” document is deleted. Does anyone have an idea in what event should I insert my code?
Seems like I cannot use the PostDocumentDelete and QueryDocumentDelete in DB Resources since this is triggered if the user clicks the Delete key (and the user can still undelete it by pressing Del key again.). I want to delete the “child” documents only when the “main” document is deleted permanently from the DB (Del then F9).
Thanks for any help!
Jen
Subject: Delete document
One option is to create an action button and this must be pressed by the user to delete the main document. The action button can have script, using the Responses property of the NotesDocument class to get the handle on all the responses. You can then delete all the responses belonging to the main document.
Another way is to have a scheduled agent that loops through all the documents with no main documents and delete them on the backend. (i.e. using the ParentDocumentUNID and checks if the parent still exists)
Subject: RE: Delete document
Thanks for the response.
I already have the Delete button but the user can still opt to delete docs using Del key. I don’t want to “disable” deleting through Del key by setting continue = false in QueryDocumentDelete because using Del key might be more comfortable for them.
If it is the last resort, I might be using a scheduled agent to delete responses without main docs.
Any more suggestions? Thanks again.