Adding a trash folder to an application

About this task

Many applications benefit from a trash folder that users can drag documents into. The topics are moved into the trash folder and marked for deletion. In a Notes® view, the documents remain in the Trash folder until the user either presses F9 to refresh the view, or until the user closes the database and confirms the deletion. If the user does not want to delete the documents, they remain in the trash folder marked for deletion. The user can drag documents back into another view and remove the deletion mark. For an example of a trash folder in an application, see the Domino® Designer mail template.

To add a trash folder to an application, create a new folder and assign it the name ($trash). You then need to write code for the folder events to handle the document deletions. For an example of how to program the events for the $Trash folder, see the Notes® Release 6 mail template (mail6.ntf).

Example of programming a $Trash file

The following examples are taken from the $Trash folder in the Notes® Release 6 mail file:


In the QueryRecalc event, the formula is:


The Restore action uses the following code:

@Command([MoveToTrash])     {for Web}
@Command([ToolsRunMacro];"(Restore Document)")   {for Client}

The agent for the restore action uses the following code:

@Command([MoveToTrash])     {for Web}

Empty Trash
@Command([EmptyTrash])      {for Web & Client}

Trash folders in the view applet

About this task

If you display a trash folder as a view applet in a Web application, documents marked for deletion in a Notes® client are also marked for deletion in the view applet. But refreshing the view in a browser by pressing F5 does not delete the documents from the trash folder unless you create an action to empty the trash. For an example of this, see the Discussion template (discsw6.ntf).

Documents marked for deletion in the view applet will appear as marked for deletion in the Notes® client after you close and reopen the database in the Notes® client.