Hi,
I am trying to call an agent (Actually 2) one after an another from a click of a button.
The problem is that I am not getting any errors in my code. I have run my agents separately and they have run fine.
When called from the click of the button, no eerors but the part which the agent does , do not get done.
Code :
Click of a button (Approve Button) - There are simple 2 agent called when person approves a document.
Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIdocument
Dim Agent1 As NotesAgent
Dim Agent2 As NotesAgent
Set db = s.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set Doc = uidoc.Document
If (Value = True) Then
Set Agent1 = db.getAgent (“Agent1”)
If Agent1.Run (doc.NoteID) = 0 Then
'Nothing
Else
Messagebox " Error message"
End If
Set Agent2 = db.getAgent (“Agent 2”)
If Agent2.Run (doc.NoteID) = 0 Then
'Nothing
Else
Messagebox " Error message "
End If
End If
Agent 1 (Updates a document in another database with approval status)
…
Server = Evaluate(“@Subset(@DbName; 1)”)
path = Evaluate(“(@LeftBack(@Subset(@DbName;-1);‘\’))”)
path = path (0) & "\db.nsf"
Dim Lookdb As New NotesDatabase(server (0) , path )
'People tracking database*****
Set view = Lookdb.Getview (“NameView”)
'People Tracking View****
Dim lookupdoc As notesdocument
projectnumber = Cstr(Doc.ProjNumber (0))
ProjDate = Today
Set updateTools = doc.getfirstitem (“Tools1”)
PN = doc.TeamLeader (0)
Set Lookupdoc = view.getdocumentbykey ( pn)
If updateTools.Contains (“Apprentice Project”) Then
If lookupdoc.GBApprenticeProject (0) = “” Then
Lookupdoc.GBApprenticeProject = ProjDate
lookupdoc.ProDt1 = projectNumber
End If
End If
Call Lookupdoc.save (True, False)
Call doc.save (True, False )
Agent 2 (Send Out an E-mail )
…
Set lookupview = db.getview(“Lookups”)
Set lookupdoc = lookupview.getdocumentbykey (“External Coach”)
Dim MailItem As NotesItem
Set Mailitem = Lookupdoc.GetFirstItem (“values”)
Call Mailitem.AppendToTextList( doc.TeamLeaderEmail (0) )
Maildoc.Sendto = Mailitem.values
Set rtitem = New NotesRichTextItem( MailDoc , “Body” )
Call rtitem.AppendText("Attached are the Project report and Cover Letter(s) for your approval. ")
Call rtitem.AddNewline(1)
Call MailDoc.Send( True )
Please let me know what is wrong with my agent call from the button.
I checked the Domino Server log also but there is no indication that my agent ran.