Manage Learn to apply best practices and optimize your operations.

How to send a document as a link in a Lotus Notes email Gunasekaran Subramanian explains how to implement Formula language code that will send documents as links within Lotus Notes email.

This Formula code creates the ability to add a document as a link in a Lotus Notes email. It also includes the database name and field values to the subject line.

I've also set up the code so that it won't send the document unless it has been saved. This may cause problems though, because the Lotus Notes user may leave the document unsaved.

The @UpdateFormulaContext command is used to set the Lotus Notes database name: "document title" in the subject line of the email.

Note: This code won't send an email. It is the user's choice to select the "To" list for the email.

@Prompt([Ok]; @DbTitle; 
"New documents cannot be pasted 
as a link. Please save the document 
before using this functionality"); @Do(
 @Prompt([Ok]; @DbTitle;
 "docTitle field does not exist. Please 
contact the Administrator");
MailSubject :[email protected] + " : " + docTitle;
@MailDbName; "Memo"; 1);
  @SetField("Subject"; MailSubject)


This example could be very useful if used in the right context. The only feedback I have is that deeply nested @If and @Do commands can be very difficult for people to read -- especially when trying to match up the end parenthesis. It is much more straightforward to simply exit the routine using the @Return command (and @Prompt command as well). The simplified code would start like this:

@If( @IsNewDoc; 

@Return( @Prompt([Ok]; @DbTitle; 
"New ... functionality") ); 
@Success );

@If( @IsUnavailable(docTitle); 


—Doug J.

Do you have comments on this tip? Let us know.

This tip was submitted to the tip library by member Gunasekaran Subramainian. 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.

7 tips in 7 minutes: An introduction to Formula language Formula Language Learning Guide Formula FAQ Formula Language Reference Center

Dig Deeper on Lotus Notes Domino Formula Language

  • Favorite iSeries cheat sheets

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