Manage Learn to apply best practices and optimize your operations.

Send An Email Button With Lotusscript

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
With memo
.Form = "Memo"
.SendTo = "Notes Team" 'The name of the person or group that you want
to send the message to
.Subject = "Email with button"
End With
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
Call temprtfield.Remove
Call memo.Send(False)

End Sub

This was last published in November 2000

Dig Deeper on Domino Resources - Part 5

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...