Saving Rich text fields (Lotusscript)

My problem is following:

In a document I have a dialog list that is linked to documents on other database

(visible in edit mode, hidden in read)

I also have a rich text field that will contain

a link to the document selected in the dialog list (visible in read, hidden in edit)

I edit a rich text field when a document is open.

If I call doc.Save to save the changes to rich text field, the changes will be overwritten by

uidoc.Save when the user saves the data.

If I call uidoc.Save BEFORE editing the rtf and THEN call doc.Save, the uidoc.Close will prompt the user whether or not they want to save the data (as comparing front-end document without the changes to modified back-end document gives the result that the document has been modified since last uidoc.Save)

Now, the solutions I could use here would be

either:

  1. To save the data in Terminate-phase, but I am

not really sure how to get a reference to the doc at that point.

OR

  1. To create the rich text field contents at QueryOpen, thus changing the Modified-property of the document every time it would be opened.

Subject: Saving Rich text fields (Lotusscript)

This has been covered many times – you can’t make back-end changes to the rich text while the document is open. Capture any user changes with uidoc.Save, close the doc, make your changes and save the back-end doc, then re-open the document.

Subject: RE: Saving Rich text fields (Lotusscript)

Yes, this is what I asked about:

How do you refer to the current NotesDocument

after you have closed the NotesUIDocument?

Even though I do the changes and save the doc

AFTER I have called uidoc.Close, I am still prompted whether I wish to save the changes.

Subject: RE: Saving Rich text fields (Lotusscript)

Well, I usually grab, say, the document unique id and use that to get the document.

Subject: RE: Saving Rich text fields (Lotusscript)

Thank you for your patience,

in Form/Terminate-event the following worked:

Set doc = uidoc.Document

universalID = doc.UniversalID

Call uidoc.Close

Set doc2 = db.GetDocumentByUNID(universalID)

Call ModifyRichTextFieldsFunction(doc2)

Call doc2.save(true, false)

I had tried this earlier in an Action, and that

had failed so I expected similar behavior from elsewhere too.