The @Command([MailForward]) forwards the current UI document by placing its entire contents into a mail memo that a Lotus Notes user can address and send.
Recently, I was asked to recreate and slightly tweak this functionality. I wanted to include only a portion (or subform) of the current UI document. I also wanted the memo to be executed through the back end and sent via the click of a button.
The key to accomplishing this was to isolate the subform in its own form. After doing so, I could copy the subform's contents to the clipboard, paste them into a rich-text field and send them to a specified Lotus Notes user.
You can create the same basic forms and code for this utility in your own Lotus Notes Domino environment using these three steps.
- Create a hotspot button on the subform that you want to email and add the following code to the "click" event.
Note: In the hotspot button's "hide-when" options, check the box to hide when "Copied to the Clipboard."
(Click on code for enlarged view and script download.)
- Create a form in your Notes database and name it "TempForm."
- Insert the subform from Step 1 into the "TempForm" form.
- Optional: If your original underlying form has rich-text fields with attachments, add those fields on the tempform subform in a hidden section. The hidden section's properties must be set to "auto-collapse" upon opening. If they're not, attachments from the main form will appear at the bottom of the email when it's sent.
- Copy and paste the following code into the "PostOpen" event in the "TempForm" subform.
(Click on code for enlarged view and script download.)
- Create a form in your Lotus Notes database and name it "Memo."
- Create a rich-text field that can be edited on the "Memo" form, and name it "Body."
- Copy and paste the following code into the "PostOpen" event in the "TempForm" subform.
(Click on code for enlarged view and script download.)
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Chad Martin. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.