I’ve searched through this forum to find my answer and I have had no luck. I’m trying to pull in a multi-value field with LotusScript. The values in this field are being used to send an email notifcation as the CC recipients. For some reason, its not working. Here’s my code:
Sub Initialize
On Error Goto processerror
Dim recips(2) As Variant
Set session = New NotesSession
Set db = session.CurrentDatabase
Set wDoc = session.DocumentContext 'the in-memory document.
Set MemoDoc = New NotesDocument(db)
Dim rtitemStyle As NotesRichTextStyle
Set rtitemStyle = session.CreateRichTextStyle
Set rtitem = New notesrichtextitem(MemoDoc,"Body")
MemoDoc.Form = "Memo"
Call wDoc.Save(True,False)
Dim managers As Variant
managers = wDoc.getitemvalue("d_manager")
If wDoc.FormName(0) = "OIG40" Then
MemoDoc.SendTo = "IAB-AssaultThreat_Group"
MemoDoc.SendTo = managers
Elseif wDoc.FormName(0) = "HRM40" Then
Dim HRMRecipients(2) As Variant
HRMRecipients(0) = "Marianne Harris"
HRMRecipients(1) = "Frank Risler"
HRMRecipients(2) = "Deborah Clarkson"
MemoDoc.SendTo = HRMRecipients
End If
MemoDoc.Subject= "Assault /Threat Report"
Call rtitem.addnewline(1)
Call rtitem.addnewline(1)
Call rtitem.appendtext("An assault threat report has been submitted by " & wDoc.RequesterName(0) )
Call rtitem.addnewline(1)
Call rtitem.addnewline(1)
Set serName = New notesname(db.server)
'the line below is to open it up on the browser...not the doclink
Call rtitem.appendText("http://" +serName.Common+"/" & Db.filename & "/(DocID)/" & wDoc.UniversalID & "?OpenDocument" )
'Call rtitem.appendDoclink(wDoc,"")
Call MemoDoc.send(False)
dbserver$ = db.server
Dim dbservername As New notesname(dbserver$)
host$ = dbservername.common
dbpath$ = db.filepath
If Instr(dbpath$,"\") <> 0 Then
Mid$(dbpath$,Instr(dbpath$,"\"),1) = "/"
End If
href$ = "/" & dbpath$ & "/Web Report Processed?OpenPage"
url$ = "http://" & host$ & href$
Msgbox url$
Print "[" & url$ & "]"
Exit Sub
processerror :
Msgbox "Error" & Str(Err) & ": " & Error$,16,"Submit"
Exit Sub
End Sub