Create Memo from Form Entry

UPRRDevelopers
UPRRDevelopers used Ask the Experts™
on
I have created a form with several fields that a user will need to complete.  When the form is complete, I want to have a button at the bottom titled "Send Document".  When they click the button, I want Notes to (1) create a new memo using the "Memo" form and (2) copy all the fields from the current form to the new memo.  I have searched all over, but I can't find a clear example of how this can be done.  I tried using @Commands, but it seems I can only copy one field over at a time.  I'd like to do this with LotusScript if possible.  Any ideas would be appreciated... thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
If you use True as the first param of Send method the whole form design is saved inside e-mail and sent like that, so that recipient sees the doc as you do.
This way the e-mail is larger, because it contains the design description.
Dim w As New NotesUIWorkspace
Dim doc As NotesDocument
Dim recipients( 2 ) As String
 
Set doc = w.CurrentDocument.document
 
recipients( 0 ) = "Jim Dinauer/Domain"
recipients( 1 ) = "Betty Dinauer/Domain"
recipients( 2 ) = "Mary Sticka/Domain"
 
Call doc.Send( True, recipients )

Open in new window

Author

Commented:
I tried something like this before, and I remembered getting an error.  I tried again, and it complained that there was "No form associated with document".  So I added "doc.form = "Memo" and it gets past that error, but then I get   "A Stored form cannot contain computed Subforms"

Commented:
The form cannot be determined because you have to save the document before sending it.
Add this line:

Call doc.Save( True, False, True )

above the "Send" line.
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Commented:
OK, here it is:
Sub Click(Source As Button)
	Dim w As New NotesUIWorkspace
	Dim doc As NotesDocument
	Dim uidoc As NotesUIDocument
	Dim recipients( 2 ) As String
	
	Set uidoc = w.CurrentDocument
	Set doc = uidoc.document
	
	recipients( 0 ) = "Jim Dinauer/Domain"
	recipients( 1 ) = "Betty Dinauer/Domain"
	recipients( 2 ) = "Mary Sticka/Domain"
	
	Call uidoc.Save( )
	Call doc.Send( True, recipients )
End Sub

Open in new window

Author

Commented:
Still not working. This is the button code ...

Sub Click(Source As Button)
      Dim w As New NotesUIWorkspace
      Dim doc As NotesDocument
      Dim recipients( 2 ) As String
      Set doc = w.CurrentDocument.document
      recipients( 0 ) = "My Name/Domain"
      'doc.form = "Memo"
      Call doc.Save( True, False, True )
      Call doc.Send( True, recipients )
End Sub

If I remark the doc.form entry, I get the error that no form is assocated with the document.  If I put it in, the note goes, but I get nothing in the body.

Author

Commented:
Wow, that last one was what I needed.  Is there any way to suppress the "Send Document" button?
Commented:
Try this to hide the button

In the button's properties (hide-when tab): Hide paragraph if formula is true:
docSent != ""

then add this line to your code (above doc.Save line):

doc.docSent = "1"

Author

Commented:
Outstanding!  It's working perfectly now.  You've made my day!  Thanks so much for your quick help and response.

Author

Commented:
Fast and completely accurate .. couldn't ask for more.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial