Skip to main content
    Country/region select      Terms of use
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

NoDeletionCol.gifI saw a question this morning in the 5/6 forum about embedded views and the fact that they don't show the part of the selection margin that displays an X when the document is flagged for deletion.

Actually, this is only true if the "Allow soft deletions" database property is enabled. This is SPR# RGAU73VJF2. Some developer at Lotus who shall remain unnamed, apparently assumed that if you used this database property, the deletion mark in the embedded view wasn't needed because when you delete a document, it would just be gone, so there would be no need to flag it. This is the way it happens in the mail file.

As I discovered after playing around with this option for a bit, that's not how it works. When you enable soft deletions (and create a Trash view) and do nothing else, there's no difference whatever in the client UI. If the user presses Del, the document is marked for deletion with an X -- same as before. When they refresh the view or exit the database, they're asked if they really want to delete the documents -- same as before. The only difference is in what happens after that point -- rather than being erased for good, the flagged documents are shifted to the Trash view (which may have a different name and is often called "($SoftDeletions)" because this makes it show up as the traditional trash folder in the outline.

To duplicate the behavior of the mail file, where you press Del and the document is gone, requires one additional step. You have to add a Querydocumentdelete event in the database script that just goes ahead and deletes the documents immediately. For instance:

Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
       Dim col As NotesDocumentCollection
       Set col = Source.Documents

       col.RemoveAll False

       Dim wksp As New NotesUIWorkspace


       Continue = False

End Sub

If you look at this event in the Notes mail application, you will see it's considerably more complex than this, but this is basically what needs to happen -- you have to override the default behavior of flagging documents with an X and make something happen right away.

Andre Guirard | 7 March 2008 11:02:41 AM ET | Dunn Bros. Coffee, Golden Valley, MN, USA | Comments (5)


1) SuperNTF has Soft deletions working very well
Kevin Pettitt | 3/7/2008 12:48:36 PM

Andre, good point about the rather incomplete documentation on soft deletions. I found this to be a problem myself but through a lot of digging through the mail file as well as direct experimentation, I think I've got soft deletions working pretty well in SuperNTF ( Having recently put together a presentation on SuperNTF that I will be giving at the VIEW's Developer2008 conference, I've even written a few bullets about it:

Soft Deletions Work!

-No matter how you delete a document

-Press <Delete> key at document or view level

-Cut document(s) from a view

-Drag to Trash [Yes, the view target must be called "($SoftDeletions)" ]

-From "Delete" action in document or view [Lesson, this method does NOT trigger querydocumentdelete]

Bonus: a confirmation warning always appears to ask if you REALLY want to delete the doc(s).

Among the various tricky bits that I encountered was executing a delete command that included a document currently being shown in a preview pane. Both the mailfile and SuperNTF handle that as well.

I'm so pleased with the result in SuperNTF that I am offering a prize (don't ask what) to anyone who can break it ;-).

2) Soft deletions information that’s missing from the help
harkpabst meliantrop | 3/10/2008 4:39:53 AM

Was - by chance - that unnamed developer the same person responsible for the bug, where selection marks, once they were set, will not disappear on further clicks in embedded views, if the "transparent background" property is set?

3) Soft deletions information that’s missing from the help
Glen Urban | 3/10/2008 11:29:07 AM

There is another problem with Soft Deletes: If Document Locking is enabled Notes prompts an Author with a message saying that they must lock the document before deleting. This is not the most user friendly way of deleting a document.

Kevin, a suggested improvement for SuperNTF would be to automatically lock the document in QueryDocumentDelete (if doc locking is enabled) and then delete it. This would make the document locking transparent to the end user. I have done this in my own template DB (although not as sophisticated and polished as yours).

4) Soft deletions information that’s missing from the help
Kevin Pettitt | 3/10/2008 3:22:04 PM

@Glen, thanks for the feedback. I'm not exactly sure whether I've done anything deliberate to avoid the doc locking prompt you describe, but my development version of SuperNTF has locking enabled and I don't get prompted. I don't see anything in the querydocumentdelete/postdocumentdelete events that appear to explicitly address the issue. It seems likely that Call dc.RemoveAll(False) command in the querydocumentdelete event (this is what actually executes the deletion in SuperNTF), handles the locking issue internally.

In short, SuperNTF already does what you want, even if I'm not sure why ;-)

5) Soft deletions information that’s missing from the help
Glen Urban | 3/10/2008 8:13:25 PM

@Kevin. That's interesting as I did get this problem with SuperNTF when testing. Maybe it's dependent upon client version? We are using 6.5.6 at the moment.

Here's a link to a "usability request" on the Lotus support/knowledge base

{ Link }

6) Soft deletions information that’s missing from the help
Kevin Pettitt | 3/11/2008 11:10:33 AM

Hi Glen,

I do not presently have a 6.5.6 test environment, but I do have a 6.5.4 and I can try to recreate it on that when I get a chance. You could help by submitting a formal request on the SuperNTF page so I don't forget about it :-).


7) Soft deletions information that’s missing from the help
Manfred Meise | 4/1/2008 1:13:04 PM

Softdeletions work fine for me in my applications. But how to harddelete a document in databases having softdeletions enabled ?


8) Re: Hard deleting in a soft-delete world
Andre Guirard | 4/1/2008 9:15:00 PM

Manfred, read about the RemovePermanently method.

9) Soft deletions information that’s missing from the help
Jerry Chen (aka Jerry C Chenster in the forums) | 4/29/2008 5:31:30 PM


When I incorporate the lines that you suggested, it works nice to remove deleted documents from view right away. Unfortunately, what I'm experiencing is that the PostDocumentDelete event doesn't kick in. We have code that upon deletion of a certain type of document, it will mark other documents for delete. Now that doesn't happen. What am I missing....?


10) Soft deletions information that’s missing from the help
Andre Guirard | 4/30/2008 3:43:26 PM


UI event code only runs in response to UI events -- not when you do the same thing in the back end. Put your code in a function and call the function as regards any documents you're deleting in the Querydocumentdelete event (put it in a script library so you can call the same function from multiple places in the design).

 Add a Comment
Comment:  (No HTML - Links will be converted if prefixed http://)
Remember Me?     Cancel

Search this blog 


    About IBM Privacy Contact