Getdocumentbyid retrieve the old version of a doc

Hi all,

In fact I have posted the question before but seems not getting much response, so I changed the topic and post it again, forgive me!

My application will create a document and multiple users may act on it. I do not use any locking and version control, and no response doc will be created, and the box for no conflict doc will be built is checked.

The logic is when finish editing a doc, before save, the program will use getdocumentid to retrieve the same doc (backend doc) with the same noteid. Then compare the two doc (frontend vs backend) to see if it had been modified by others.

I test it by editing the doc both from web and client. And save it first on web (successful) and the doc is updated with new field values. Then using lotus script debugger, I try to save the doc from client. By logic, it will retrieve the backend doc with corresponding noteid. But I found that the doc retrieved is the original doc before edit, but not the one already updated from web. (But I am sure it has been modified on web since I can view it updated from browser)

So the codes simply think that the doc is not modified and continue to save, but then on save, it prompt a box to ask if conflict doc should be built.

My question is why getdocumentbyid retrieve an old version of the doc, is it cached? if yes, how to avoid it? Any simpler method to detect if the doc is updated (although I think this method is he simplest!) ?

Thanks in advance

Subject: Getdocumentbyid retrieve the old version of a doc

Yes, the GetDocumentByID will often return a cached document.The way to avoid these problems is to not use GetDocumentByID.

Create a view (you may already have one) sorted on @Text(@DocumentUniqueID).

Use set docBack = yourview.GetDocumentByKey(unid, True) to get a reference to the document.

I think you will find this working better.

Subject: RE: Getdocumentbyid retrieve the old version of a doc

Thanks Kenneth, it works!