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

Dig Deeper on Domino Resources - Part 5



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury