I’m adding a feature to a database, a button that sends e-mail to an address specified by a field in the Rolodex. The script works perfectly when it’s an Action of the form, if a document containing an e-mail address is open.
If the same script is used in a View action, it fails to address the memo, even if a document is selected.
Here’s the script:
@Command([Compose];@MailDbName;“Memo” );
theAddressee := sh_MailAddress;
@UpdateFormulaContext;
FIELD EnterSendTo := theAddressee;
Back when I was a full-time Notes developer last (R4.5) I would have expected this to work on selected docs.
Okay, I thought, perhaps the document needs to be open. I added
@Command([OpenDocument]);
@UpdateFormulaContext;
to the formula. The document opens, but inexplicably the value of theAddresee remains null.
I’m sure I’m missing something obvious, and I’ll be grateful for any help.
Subject: RE: Action works on document, not when doc is selected in view
Mark Hughes asks,
Why not use @mailsend(theAddressee;"";"".......
Because I want to let the user type a message, not send a pre-generated one. My reading of @MailSend doesn’t show that capability, but I’m more than willing to be educated.
Subject: RE: Action works on document, not when doc is selected in view
code from a button that does something simalar is LS
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db1 As NotesDatabase
Set db1 = session.CurrentDatabase
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Set session = New NotesSession
Dim db As New NotesDatabase( "", "" )
Call db.OpenMail
Dim uidocmail As NotesuiDocument
Set uidocMAIL = workspace.ComposeDocument(db.Server,"mail\" + db.FileName,"Memo")
Dim rtitem As NotesRichTextItem
Dim docmail As NotesDocument
Set docmail = uidocmail.Document
Set rtitem = New NotesRichTextItem( docmail, "Body" )
Call uidocMAIL.FieldSetText("EnterSendTo", uidoc.Document.Requestor(0))
Call uidocMAIL.FieldSetText("Subject","IT Work Order: " + uidoc.Document.ExpNumber(0))
Dim body1 As String
body1= uidocMAIL.FieldGetText("Body")
Call uidocMAIL.FieldSetText("Body","Summary: " + uidoc.Document.summary(0))
Call rtitem.AppendDocLink(doc,"Link")
Call uidocMAIL.FieldAppendText("Body",body1)