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.
@If(@IsNewDoc; @Prompt([Ok]; @DbTitle; "New documents cannot be pasted as a link. Please save the document before using this functionality"); @Do( @If(@IsUnavailable(docTitle); @Prompt([Ok]; @DbTitle; "docTitle field does not exist. Please contact the Administrator"); @Do( MailSubject :=@DbTitle + " : " + docTitle; @Command([ComposeWithReference]; @MailDbName; "Memo"; 1); @UpdateFormulaContext; @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); ...
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com 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.