I have to replace formula language I have in place for sending an email from a database with Lotus Script so that rich text can be included in the email. The emails are generated from a button on a form, and send some text that is input in one field, and a doclink to the form where there is more information and an attachment.
I have some lotus script that I modified from a post that I found. So far, it does send the rich text from the Comments field, but I get an error that it can't find the Daily Mill form, and I'm not sure how to set all the fields that need to be updated, or how to do the prompt.
Any pointers gratefully accepted, I'm under a tight deadline so sample code appreciated even more!
@Command( [EditDocument]; "1"; "1" );
ans := @Prompt([YesNo]; "Send memo?"; "Press Yes to confirm Send");
@If(ans = 1;
@Do(@SetField("Sent_H";"Yes");@SetField("Sent";"Yes") ;@SetField("Report_Date";@Today); @SetField("ReportTime"; @Now);
GlobalComment +@NewLine+@NewLine+ Comments + @NewLine + @NewLine + Body + @NewLine + @NewLine + "Please click this link to view the entire report. ----> ";[IncludeDoclink]) ;
Lotus Script so far:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim note As NotesDocument
Dim rt As NotesRichTextItem
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db ) ' Mail Doc
Set uidoc = ws.CurrentDocument
Set note = uidoc.Document
If uidoc.EditMode Then
Set rt = note.GetFirstItem( "Comments") ' The documents richtext field
doc.Form = "Daily Mill"
doc.SendTo = "Joyce Kee/Fms/MetLife/US"
doc.Subject = "Rich Text Test"
Set body = New NotesRIchTextItem( doc, "Body" )
Call body.AppendRTItem( rt )
Call doc.Send( False )