Confirmation of Deletion

This tip is an easy method to ask an user for confirmation before deleting any document in a Domino Web application. There is no straightforward way to ask for confirmation and delete the marked documents only from a view for applications on the Web. Hence, use a JavaScript confirmation box in the delete action. Update a field, say, DeleteConfirm field on the form to "yes" or "no". "Yes", if user presses "OK" on the confirmation box. "No" otherwise.

In the view, write the selection formula to include only those documents where DeleteConfirm field is not marked to "Yes". Run a scheduled agent on a view that that selects all the documents marked with DeleteConfirm field as "Yes" and use RemoveAll method to delete them.

Delete Documents agent:

Sub Initialize 
        Dim Session As New NotesSession 
        Dim db As NotesDatabase 
        Set db = Session.CurrentDatabase 
        Dim view As NotesView 
        Set view = db.GetView("DeleteDocuments") 
        Call view.Refresh       
        Dim collection As NotesDocumentcollection 
        Set collection = view.GetAlldocumentsbykey("Yes",True) 
        Call collection.RemoveAll(False) 
End Sub

Javascript for Delete Action button:

if (confirm("Are you sure you want to permanently delete this document?")) 
            alert("This document has been Deleted"); 
          document.forms[0].DeleteConfirm.value = "Yes"; 
else { 
      alert("This document is not being Deleted"); 
         document.forms[0].DeleteConfirm.value = "No"; 


This was first published in March 2001

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.