Using LotusScript, how can I know if a parent document is open?

Hi all, we have an application that can create a parent document and several response documents. When a response document is saved, it modifies fields in the parent document using the NotesDocument object. The problem we’re having is if the parent document is open and a user creates a response document which modifies fields in the parent document, we receive replication conflicts.

One way of resolving the problem is to use LotusScript code in the “Save” action of the response document to check if the parent document is open. If it is, inform the user and do not permit save of the response document. However, we are unable to find a way using LotusScript where we can check if the parent is open. How would we do this check? All suggestions are welcome. Thanks

Subject: Using LotusScript, how can I know if a parent document is open?

hi

try following:

Set parent = Notesdatabase.GetDocumentByUNID(responseDoc.ParentDocumentUNID)

If Not parent.IsUIDocOpen Then

'Now You can save

Else

'Message for example: “Close parent please”

End If

Hope this will help

H. Mueller

Subject: RE: Using LotusScript, how can I know if a parent document is open?

Heinrich’s solution will not work, ISUIDocOpen method is not intended for this purpose, from Notes Help :

“Indicates whether a NotesDocument object (back-end document) is accessed through a NotesUIDocument object (front-end document).”

What you are trying to do is not really something Notes is best suited for, this is really relational db behaviour.

You could have a flag field on each parent which gets toggled each time the document is opened and closed, or have a temporary response document that is created only when the parent is open. You then just have to check for the value of the flag field or the existence of the temporary response.

However, the reliability of these techniques will depend on the application, how it is used and if you have multiple replicas or large numbers of people accessing documents simultaneously.

Subject: RE: Using LotusScript, how can I know if a parent document is open?

You could also investigate the possibility of using the document locking feature for the database in question. With a little extra effort on your part, it may do the trick.dgg