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.
Start the conversation
0 comments