Hi,
I want to find out if the uiDocument has been modified by the user. Lotus Notes automatically shows the default message “Do you want to save…” when you close the uiDocument without saving it first. Can we capture this programatically?
Thanks,
Mani.
Subject: RE: Has the uiDocument been modified?
No, but if you say more about what you’re trying to accomplish by doing this, perhaps someone can suggest a different way.
Of course, you could use Queryopen event code to read off the values of all the fields, then compare them later to see what’s changed.
Subject: RE: Has the uiDocument been modified?
I have to refresh changes in the parent document to all the child documents. I was trying to prevent redundant refreshes when the user clicks on Save without changing anything on the form at all.
Subject: RE: Has the uiDocument been modified?
Maybe you don’t need to store copies of the information in the response documents. Maybe you can use Computed for Display fields and @GetDocField or @DbLookup to pull values from the main document when the response is opened.
Or, if you decide you do need to store copies, what you need to prevent an unnecessary update is not to know whether Notes considers the document modified, but whether the fields you would copy are different from what they were when you opened the document. You don’t really care about other fields. So the approach I described is what you need to do – store the field values in global LotusScript variables when you open the document, and compare in the Postsave event.
Alternatively, you could compare the field values in the just-saved main document with the values in the response documents, not caring whether they have just been changed. That way, if a response document didn’t get updated when the data was edited before, it will be updated when it’s edited again. The update might have failed initially because the document was created in another replica and didn’t exist yet in the current replica when you edited the parent.