Home > Domino Tips > Developer > LotusScript > Dynamically update Lotus Notes rich-text fields using LotusScript
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Dynamically update Lotus Notes rich-text fields using LotusScript


Amith Narera
11.20.2007
Rating: -4.38- (out of 5) Hall of fame tip of the month winner


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


Whenever a change is made to a Lotus Notes document in the back-end, the same change is reflected in the front-end document -- except the rich-text fields. For rich-text field changes, you have to close the front-end Lotus Notes document and open it again using the NotesUIWorkspace.EditDocument method. However, this ends up also firing all associated Lotus Notes form events. This tip overcomes this problem by allowing you to dynamically update the front-end rich-text fields without closing and re-opening the main Lotus Notes form.

For the sake of simplicity, I am appending the current Lotus Notes username, system time and attachments (as selected by the Lotus Notes user) to the rich-text field. The LotusScript code below also allows you to append rich-text item from another Lotus Notes document (commented in the code). You can modify it for your needs.

Here is an outline of how the LotusScript code works:

  • Create a dummy Lotus Notes document in the back end using the db.CreateDocument method.
  • Add a rich-text field to it.
  • Perform all the necessary actions on this rich-text field.
  • Open the Lotus Notes document in the front-end with a dummy form with just one rich-text field (with the same name as created in the second step above).
  • Place the cursor in this rich-text field, select all the text, and copy everything to the clipboard.
  • Close the dummy Lotus Notes form.
  • Go to the destination rich-text field on the main Lotus Notes form.

  • Paste everything from the clipboard.
  • Mission accomplished.

Here are the steps you'll need to attain the desired result:

  1. Create a new form. Name it "Dummy Form."
  2. Place a rich-text field, named "DummyRT" on it.
  3. Open your main Lotus Notes form where you'd like these updates to happen.
  4. Create a new Action button, and name it "Update RT Field." You may use the LotusScript code anywhere. For the sake of simplicity I am using it in a button.
  5. Select LotusScript as the coding language and paste the code given below into it.

Now -- with ...


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



RELATED CONTENT
LotusScript
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
LotusScript filters and attaches files to a Notes form

LotusScript
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 agent automates selective mail file replication

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


a click of this action button -- you can update the front end of your rich-text item in real-time without having to close and re-open the main Lotus Notes document. You can also apply the same logic to move contents of one rich-text item to the other rich-text item on the same form in real time -- without having to re-open the front end document. If you'd like to do that, this code will help you:

MEMBER FEEDBACK TO THIS TIP

This is an excellent tip that has benefited one of our applications, while simultaneously removing undue bottlenecks and hurdles. Auditing dynamic tables over to rich-text fields helps prevent users from saving Lotus Notes documents unnecessarily.
—Prasanna P.

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

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