This is my first foray into Lotus Script so excuse me if I’m a bit clueless!
I’m trying to generate a memo form in the current users email database from another notes database - and copy an attachment from the current open form in other database into the body of the new memo form. My code currently looks like this - its triggered by an action button from a form:
Sub EmailQuote()
'Declare backend objects
Dim doc As NotesDocument
Dim db As NotesDatabase
Dim item As NotesItem
Dim session As New NotesSession
Dim UserMailServer As String
Dim UserMailFile As String
Set db = session.CurrentDatabase
'Declare front end objects
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim sEmailSubject As String
Dim sSendTo As String
Dim memo As NotesUIDocument
Set uidoc = workspace.CurrentDocument
'get the attachments from the document
Set doc = uidoc.Document
Set item = doc.GetFirstItem( "GeneratedQuotes" )
'create email with attachment
sEmailSubject = "TMG Quote"
sSendTo = "Jason Hornbuckle"
UserMailServer = session.GetEnvironmentString("MailServer",True)
Set Mailserver = New NotesName(UserMailServer)
UserMailFile = session.GetEnvironmentString("MailFile",True)
Set memo = workspace.ComposeDocument(MailServer.Abbreviated,UserMailFile,"Memo")
Call memo.FieldSetText("EnterSendTo",sSendTo)
Call memo.FieldSetText("Subject",sEmailSubject)
Call item.CopyItemToDocument(memo, "Body") 'This is the part that isnt working!!
End Sub
It all works fine except that I cant work out how to get the attachment into the memo body field? The “CopyItem” method appears to only work for a back-end document? As I had it working to generate an email with the attachment and automatically send to a recipient - but I need the users to be able to manually edit the body field(ie enter a message) before the email is sent. Is there a way to do this?