Someone told me that I had to work with the "postdocumentdelete" event of "database script" from the user. But this is not good for me, because it uses (I think) client classes, and I need to use server resources like environment variables or XML files.
Can you help me, please?
There are a couple of approaches you could investigate.
There's no way to directly trigger a server agent when documents are about to be deleted. However, in the Querydocumentdelete of the database script, you can use NotesAgent.RunOnServer method to call a server agent, passing in as a parameter the note ID of one document that is about to be deleted. The server agent can do whatever needs to be done.
This will only detect deletions done via the Notes client UI, however. If the user runs an agent that delete documents, this event is not triggered. Also, things get complicated with "soft deletions" -- when they delete a document it's not really getting deleted right away.
Even without soft deletions, do you want to execute this code when the user flags the document for deletion, or when they exit the database or press F9 and it's actually deleted? If you respond to PostDocumentDelete, you also need to be prepared to respond to QueryDocumentUndelete and undo whatever you did when the document was flagged for deletion.
Alternately, you could use the "DSAPI" to write add-in code on the server. This subset of the Notes C API lets you register your code to run when various events occur on the server, including deletion of a document. You would have to write this code in C or C++, and it would only trigger when the document is really deleted – not soft deleted or flagged in the view to be deleted later.
Do you have comments on this Ask the Expert question and response? Let us know.
Dig Deeper on Lotus Notes Domino Agents
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.