Hi,I need to run an agent within Database Script’s postopen event. Below is my code in the postopen event:
Dim s As New NotesSession
Dim Agent As NotesAgent
Dim db As NotesDatabase
Set db=s.Currentdatabase
Set Agent = db.GetAgent( “AgentName” )
Dim datev As New NotesDateTime(agent.LastRun)
Dim datex As New NotesDateTime(Now())
Dim date0, date7, datetoday As String
date0 = datev.DateOnly
'day the agent ran
Call datev.AdjustDay (+7)
date7 = datev.DateOnly
'7 days after the agent run
datetoday = datex.DateOnly 'today
If date7 = datetoday Then
agent.Run
End If
The agent log shows that the agent did run, but, the agent doesn’t trigger the alert (messagebox) that I have in the code. Is there anything that I did wrong in the agent.run statement? Is my approach possible at all?
What I am doing is to alert users with certain mail file size weekly when they open their mail files.
Any suggestion is appreciated. Thanks for your help in advance.
Below is my agent code:
Dim db As NotesDatabase
Dim session As New NotesSession
Dim size As Double
Dim sizemb As Double
Set db = session.CurrentDatabase
size = db.size
If size >200000000 Then
sizemb = size/1024/1024
Msgbox "Your mail file size is: “& sizemb & " MB” , MB_OK , “Warning”
End If