Hallo Forum,
folgende Codes (Aufgabe: Häkchen-Löschung) führen zur Fehlermeldung:
<Unsupported trigger in the background or embedded agent>
In der View per Button startet:
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim dbthis As NotesDatabase
Dim dc As NotesDocumentCollection
Dim datadoc As NotesDocument
Dim item As NotesItem
Dim agent As NotesAgent
Set dbthis = session.CurrentDatabase
Set dc = dbthis.UnprocessedDocuments
Dim boxType As Long, answer As Integer
boxType& = MB_YESNOCANCEL + MB_ICONQUESTION
answer% = Messagebox("veröffentlichen mit heutigem Datum?", boxType&,"Alle markierten Dokumente")
If answer% = 2 Then Goto ende
If dc.Count > 0 Then
Set datadoc = dc.getFirstDocument
While Not datadoc Is Nothing
If answer% = 7 Then Goto weiter
Set notesDateTime = New NotesDateTime( "Today" )
Set item = datadoc.ReplaceItemValue( "Datum", notesDateTime )
weiter:
Set item = datadoc.ReplaceItemValue( "Gültigkeit", "freigegeben" )
Call datadoc.Save( True, True )
Set datadoc = dc.GetNextDocument(datadoc)
Wend
End If
Call workspace.ViewRefresh
ende:
Set Agent = dbthis.GetAgent("RunDeselectAllSelected")
If Not(Agent Is Nothing) Then
Call Agent.Run
End If
End Sub
Der Agent RunDeselectAllSelected:
Sub Initialize
Dim db As New NotesDatabase("", "")
Dim Agent As NotesAgent
If (db.open("", "")) Then
Set Agent = db.GetAgent("DeselectAllSelected")
If Not(Agent Is Nothing) Then
Messagebox "DB Open"
Call Agent.Run
Else
Msgbox "Agent ist im Nirwana....."
End If
End If
End Sub
Dieser hat die Parameter:
Shared
Trigger on event
Runtime: Action menu selection
Wer hilft mir?
Alexis