I wanted to be able to send an email message using LotusScript that contained a
button for the recipient, without attaching a form to the message. This can be
used to send a button to perform some task on the users workstation i.e. add a
task to the users calendar, open a database or in the following example to
display a prompt box.
First I created a form called Prompt Button, that just has a Hotspot button on
it with the formula:
@Prompt([OK];"Seasons Greetings";"Happy New Year " + @Name([CN];@UserName));
Next, I created a LotusScript button (this could have been an agent) to send
out an email message containing this button using the following code:
Sub Click(Source As Button)
Dim s As New NotesSession
Dim db As NotesDatabase
Dim memo As NotesDocument
Dim body As NotesRichTextItem
Dim tempbuttondoc As NotesDocument
Dim temprtfield As NotesRichTextItem
Set db = s.CurrentDatabase
' Create a memo and set the fields
Set memo = db.CreateDocument
.Form = "Memo"
.SendTo = "Notes Team" 'The name of the person or group that you want
to send the message to
.Subject = "Email with button"
Set body = New NotesRichTextItem( memo, "Body")
Call body.AppendText("Click on the following button.")
Call body.AddNewLine( 1 )
' Create a temporary document with the form that has the button
Set tempbuttondoc = db.CreateDocument
tempbuttondoc.Form = "Prompt Button"
' Add the button to a temporary field on the memo
Set temprtfield = New NotesRichTextItem( memo, "temprtfield")
success = tempbuttondoc.RenderToRTItem( temprtfield )
' Add (append) the button to body field of the memo
Call body.AppendRTItem( temprtfield )
' Remove the temporary field from the memo and send it
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.