Hi all,
Is it possible to run an agent like the following on a WQO and have the data populate properly. The key to success in this is getting the first item from the looked up document and having it attach to current document being composed… the other fields I could compute on the form easy enough, but I am not sure how to compute the attachment item. I hope this makes sense.
Here is my (not working - currently just presents a 404 error) code:
Dim session As New NotesSession
Dim curdb As NotesDatabase
Dim curdoc As NotesDocument
Dim employees As notesview
Dim signature As NotesItem
Dim employee As notesdocument
Dim key As Variant
Dim server As String
Set curdb = session.CurrentDatabase
Set curdoc = session.DocumentContext
server = curdb.Server
Set employees = curdb.GetView ("admvSTF")
key = session.UserName
Set employee = employees.getdocumentbykey(key)
If employee Is Nothing Then
Exit Sub
Else
Set signature = employee.GetFirstItem( "admEmploySign" )
Call signature.CopyItemToDocument( curdoc, "" )
curdoc.csnStaffPerson = key
curdoc.csnStaffTeam = employee.admEmployTeam(0)
curdoc.csnStaffID = employee.admEmployID(0)
End If