Reload UiDocument with backendchanges

Hi,

i need to reload a UiDocument while changing from read to editmode to get changes in the backend, made there by other documents.

I tried a lot…

I tried to solve it in querymodechange:

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)

Dim ws As New notesuiworkspace

Dim ses As New notessession

Dim db As notesdatabase

Dim doc As Notesdocument

Dim doc_reopened As NotesDocument

Dim UNID As String



Set db = ses.CurrentDatabase

Set doc = Source.Document



UNID = doc.UniversalID

Messagebox UNID

Source.Close(Immediate)

Set doc_reopened = db.GetDocumentByUNID(UNID)





Set Source =  ws.EditDocument(True,doc_reopened,False)

End Sub

The document is opened new, but the Changes are not visible until i close and open the document from the frontend.

I tried it with formula in a action:

REM {Nur, wenn Dokument nicht neu.};

@If (@IsNewDoc ; @Prompt([Ok];“process Canceled”;“This function is only available for old Documents”) + @Return(“”) ; @Success);

_ID := @Text(@DocumentUniqueID);

@Command([FileCloseWindow]);

@PostedCommand([OpenDocument] ; “1” ; _ID; “”; “”)

This works, but only if there is no change in the Backend, with a change there, i get an errormessage " Angegebener Befehl kann nicht ausgeführt werden".

Now i think maybe its impossible ?

Thanks for any help,

Elke

Subject: RE: Reload UiDocument with backendchanges

I’m not sure whether there’s a way to do this when the user starts edit mode in the usual way. However, I do notice that you’ve forgotten to use Option Declare, so that the compiler isn’t telling you about one of your errors.

You will have to “delete doc” before you try to reopen by UNID, or you will get the cached value.

You should set Continue=False.

This might not work at all because it’s running in the middle of event code where the Notes client expects to have a document to execute the events on. If you rip the carpet from under its feet, it might fall down.

You might have to just have this event code set Continue = False and tell the user to use an action button to start editing. Or, you could check whether the document has changed, and only interfere if the modification date has changed.