Hello all,
I’m having problems calling an agent from multiple views.
On each of theses view I have Shared Action (written in LS). In that shared action, there is a code snippet like this :
Dim s As New NotesSession
Dim db As NotesDatabase
Dim paramdoc As NotesDocument
Dim agent As NotesAgent
Set db = s.CurrentDatabase
Set paramdoc = New NotesDocument(db)
paramdoc.mailtemplate = “1”
Call paramdoc.Save(True, False)
'Start agent and pass note ID of document
Set agent = db.GetAgent(“sendmail”)
If agent.Run(paramdoc.NoteID) <> 0 Then
'handle error
'send a notice to Domino administrator
End If
The agent starts like expected to.
In the ‘sendmail’ agent, I want to process all selected documents in the view that started the agent. I’m using a piece of code like this:
'a big chunk of variable declarations and variables assignments
Dim s As New NotesSession
Dim agent As NotesAgent
Set agent = s.CurrentAgent
Dim db As NotesDatabase
Dim paramdoc As NotesDocument, doc As NotesDocument
Set db = s.CurrentDatabase
Set paramdoc = db.GetDocumentByID(agent.ParameterDocID)
Dim collection As NotesDocumentCollection
Set collection = db.UnprocessedDocuments
If collection.Count =< 0 Then
Exit Sub
End If
Set doc = collection.GetFirstDocument
While Not(doc Is Nothing)
'send an email to emailAdress on the currently processed document
Set doc = collection.GetNextDocument( doc )
Wend
Call paramdoc.Remove(True)
For your information, the agent properties are :
Shared
Trigger On event
Action menu selection
Target All selected documents
I get this error message when I click the Shared action :
Notes error : Unsupported trigger and search in the background or embedded agent.
I need an explanation. I have search the DD help and found nothing about this error type. I also searched this forum for answers and didnt find any satisfying explanation.
Thanks again for the help/advice,
Remi