Hello,
I am having an odd problem with editing and saving a document.
There is a button on a form that executes LotusScript that adds text and a link to another document into a rich text field. It also saves the document, closes it and reopens it to view the changes. After a user uses this button, any additional changes made to the document are not saved. They are using the normal, edit, save and close buttons but the changes to other editable text fields are not saved.
Has anyone ever run across this? I put the pieces of code that dealt with the saving of the document in the LotusScript below (I left out all the initializing of variables):
Set uidoc = workspace.CurrentDocument
Set db = session.currentdatabase
Set doc = uidoc.document
If doc.IsNewNote Then
Messagebox(“This document must be saved first!”)
Else
doc.saveoptions=“0”
Call uidoc.save()
Call uidoc.close()
'Left out code to change the rich text field
Call doc.save(True,False)
'reopen the doc
Set uidoc= workspace.editdocument(True,doc)
uidoc.Save
'refresh the currently open view
Call workspace.ViewRefresh
Thanks in advance for any help!
Subject: Document no longer saving edits
Setting SaveOptions to “0” then saving the document means that the document can no longer be saved from the UI. Before the document is opened to the UI again, use doc.RemoveItem(“SaveOptions”) and save the back-end document.
Subject: RE: Document no longer saving edits
Hi Stan,
Thank you for your response. When I remove the saveoptions from the document and save the backend document before opening the UI, I get a save-replication warning and a duplicate document is created for the save/replication. Do you know how I would avoid any saving prompts or a save replication?
Thank you!!
Subject: RE: Document no longer saving edits
I usually completely get rid of the ui reference:
-
Get the UNID of the document.
-
Save the UI document
-
Close the UI document
-
Use GetDocumentByUNID to get the back-end document.
-
Manipulate back-end rich text.
-
Save the back-end document.
-
Set UI document to ws.EditDocument(True,doc)
Subject: RE: Document no longer saving edits
Hi Stan,
Thanks for above, however how would I suppress the saving prompts without changing the save options?
When I added the doc.RemoveItem(“SaveOptions”)to my code there are prompts for saving and replication conflicts.
Thanks!
Subject: RE: Document no longer saving edits
UIdoc.Save plus UIDoc.Close will not prompt for save, since the save has already been done. The UI doc will not exist when you do your back-end changes; you can Delete UIdoc if you really want to be sure. Re-getting the document WITHOUT reference to the UIdoc means that no trace of it will be in memory when you make your back-end changes, so there’s no save conflict there. Re-opening the document after it has been saved through the back end gives the user a chance to make further changes as necessary.
Subject: Forgot to take out SaveOptions?
doc.saveoptions=“0” Call uidoc.save()
Call uidoc.close()
'Left out code to change the rich text field
Call doc.RemoveItem(“SaveOptions”)
Call doc.save(True,False)
'reopen the doc
Subject: RE: Forgot to take out SaveOptions?
Hi Bill,
I’m trying to figure out how to avoid a save prompt and save replication after removing the saveoptions. Any ideas?
Thank you for your help!