Manage Learn to apply best practices and optimize your operations.

An easier way to update a rich text field

Learn how to update a rich text field without having to save, close and reopen the form.

We've all been waiting for it, but it has yet to be delivered – the ability to update a rich text field and displaying the changes to a user without having to save, close and reopen the form.

Currently, if you have a document locking enabled for the database, the traditional method of closing and reopening works. But, if you make a change to the document afterward and try to save it, a save conflict is generated. To get around this, you have to save and close the form, and create a new document to display to the user.

Here's how:

'Set db, doc & uidoc and update richtext field..........

'Display updates for user:
Dim newUIDoc As NotesUIDocument
Dim newDoc As NotesDocument
Dim oldDoc As NotesDocument
 'cannot delete doc from the ui
  
'Save Original Document:
docID$ = doc.UniversalID
doc.SaveOptions = "0" 'so users 
are not prompted to save changes 
Call doc.Save( True, False )
  
'Create New Document 
(can't just open, a conflict occurs due to 
doclocking feature in LN):
Set newDoc = New NotesDocument( db )
Call doc.CopyAllItems( newDoc, True )
Call uidoc.Close( True )
Call newDoc.RemoveItem( "SaveOptions" )
Call newDoc.Save( True, False )
Set newUIDoc = 
workspace.EditDocument( True, newDoc ) 
Delete doc Set oldDoc = 
db.GetDocumentByUNID( docID$ ) 
Call oldDoc.Remove(True)


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

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

Dig Deeper on Lotus Notes Domino Coding and Development

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close