Home > Domino Tips > Developer > LotusScript > How to create a comments field for Lotus Notes documents
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

How to create a comments field for Lotus Notes documents


Ray Green
11.21.2006
Rating: -2.53- (out of 5)


Lotus Notes and Domino tips, tutorials and how-to articles
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


VIEW MEMBER FEEDACK TO THIS TIP

To create a field for users to add notes or comments to a Lotus Notes document, you must first set up two fields.

The first, we'll call Cust_NotesTemp. It only has code in the Exiting Event. This is an editable field into which a user can enter notes or comments.

When they exit the field, the Exiting Event code trims the field of junk, stamps the new note or comment with the current date and time, adds a line feed. It then links the new comment together with the other comments already present in the Lotus Notes document, and saves it into the Cust_Notes field. When finished, it clears out the Cust_NotesTemp field.

One consideration is that the user may save the Lotus Notes document after entering comments into it, but before exiting the Cust_NotesTemp field. As such, the Exiting Event must be triggered when the document is saved by forcing the field exiting event, no matter where the cursor is. Move the cursor to some field at the beginning of the document that doesn't need any entering or exiting event code -- Call uidoc.GoToField("??? any field").

Now set up the second field and call it Cust_Notes. This field only has code in the Entering Event. This will store all notes or comments with dates/times, as well as the user's name that created each note. This is an editable, but restricted, field that only a user with manager access can edit. This prevents Lotus Notes users from changing their own comments or those of other users. Finally, add the following LotusScriptcode:

MEMBER FEEDBACK TO THIS TIP

I've found a much easier solution.

First, create two fields and call one Comments (make this an editable text field) and Comments_D (make this a computed text field). Next, use the following as the formula for the Comments_D field:

Place the form in edit mode, enter some text, save the ...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
LotusScript
LotusScript agent parses ACL to Microsoft Notepad
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
Run or restart Notes/Domino agents via text messages
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management

LotusScript
LotusScript agent parses ACL to Microsoft Notepad
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication

Lotus Notes Domino User Settings
Secure Lotus Notes/Domino 8.x from mail to unknown recipients
How to turn off the message recall feature in Lotus Notes 8
Domino server setting and email policy tricks admins must know
Top 10 Lotus Notes/Domino administration tips of 2008
Synchronize LinkedIn contacts with Lotus Notes Domino
Setting up local replication of a Lotus Notes database for offline employees
Secure Microsoft Excel spreadsheets with LotusScript
Programmatically create a shortcut for Lotus Notes
The truth about AutoSave in Lotus Notes/Domino 7
Restraining the monsters behind Lotus Notes' 'Full Access Administrator'

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


document and finally close the document. I must admit, this does not do the "clean up" that the author's LotusScript does, but that could be done with a couple of @ReplaceSubstring or @Replace commands added in.

Please allow me to add an appeal to everyone trying to do Lotus Notes/Domino development. Learn the @Functions! I see so many examples of programmers trying to do everything in LotusScript when a couple of simple @Functions can do the trick.
—Randy D.

******************************************

Randy D. is on the right track. I use the Formula language a lot and I have a form with three fields to update comments into one field and then clear the previous two so that they are blank for the next user.

To accomplish this, create two editable fields (UpdateSubject, which is optional, and UpdateDetail) and one computed field (UpdateLog). Then, create a button on the form and put this code behind it:

This grabs the username, current date and time to add into the comment. The user types a subject in the UpdateSubject field (this is optional) and the comment in the UpdateDetail field. Then click the button and it immediately adds the comment to the log below. It saves the changes and then clears the Subject and Detail fields. It then saves the form again. You can use @Command([FileCloseWindow]) command at the end to close the document.
—Linda T.

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

Related information from SearchDomino.com:

  • Tip: Prompting a Lotus Notes user for input using LotusScript
  • FAQ: LotusScript advice
  • Expert Advice: How to modify a Lotus Notes signature file using LotusScript
  • Learning Guide: LotusScript development

    This tip was submitted to the SearchDomino.com tip library by member Ray Green. 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.

    Rate this Tip
    To rate tips, you must be a member of SearchDomino.com.
    Register now to start rating these tips. Log in if you are already a member.


    Submit a Tip




    DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



  • Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
    HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Site Map




    All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts