My Delete Agent

I am running my database in a web browser and not through Notes Client.I have a form to create a simple document.

The document is automatically saved when the user clicks “Finished”. The button using the command @Command([FileSave]).

I then have a button called “Delete” which deletes the current saved document being shown. The button is run using an agent called “Delete” also, in LotusScript (Which I nicked this from the Help file):-

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim collection As NotesDocumentCollection

Dim doc As NotesDocument

Set db = session.CurrentDatabase

Set collection = db.UnprocessedDocuments

hm = collection.Count

For j = 1 To hm

	Set doc = collection.GetNthDocument(j)

	Call doc.Remove(False)

Next

End Sub

This does delete the document.

But when I open another document from a View and use the button it does not delete it.

The documents are in the same state arent’t they? (In saved mode for the agent to work?)

I have checked the log of the Agent and it says “Error: Agent must be run in a View Screen”.

I have added the button into the view screen to delete a document, but the log says the same thing.

Any answers at all?

Subject: My Delete Agent

if you have the document opened, have you thought of using session.documentcontext? In how you are describing it you are having a single document which would be perfect in the method I am recommending.

HTH – Cheers

Subject: My Delete Agent

It sounds like you have selected a trigger than is not appropriate for second level agent. There is more information on this in the Agent FAQ. In release 6 version of Troubleshooting agents I added a list of all triggers which don’t work in the configuration are trying.