Programmatically have Notes form e-mailed upon click of a button

I am working in Notes R5 and am trying to programmatically have a Notes form e-mailed upon the click of a button. In other words, the user would fill in the required data, and once the form is complete, they would click a button, which would autosave, then send to each recipient in email field1 and emailfield2 a direct link to that particular record in the Notes database. (There is a unique number on each record.)

<click this button>= emailfield1 and emailfield2, Subject, message,

How would I do this?

You want to use @Mailsend in the button. The button code might look like this:
@If(@Command([FileSave]);
@Do(
@Command([CloseWindow]);
@MailSend( emailfield1 ; emailfield2 ; ""; 
"A new document has been submitted" ; ""; 

"The new document can be reached using this link." ; [INCLUDEDOCLINK]) ); @StatusBar("Save unsuccessful"))

This code saves the document and if successfully saved, closes the document and sends the message with a link to the document.

Do you have comments on this Ask the Expert question and response? Let us know.

This was first published in July 2005