ParentDocumentUnid breaks when document updated

I apologise in advance if this has been answered elsewhere, I looked but didn’t find it - some very similar but…

I am copying documents & their responses from one database to another using NotesDocument.copytodatabase(db). This works fine & even creates the right $Refs. The views show things in a response hierarchy & everything is hunky dory.

The code runs again and the reponse documents are updated. They no longer show correctly in the view and after a lot of faffing around I deduced that this could be because the ParentDocumentUNID is no longer valid. And no I don’t mess with it in the code.

So, anyone else come across this sort of thing?

Any bright ideas as to how to get around it?

Thanks

Sue

Subject: RE: ParentDocumentUnid breaks when document updated

I’m actually surprised to hear that the initial copy works. I would have thought you’d have to use MakeResponse to link the copied responses to their copied parents.

The phrase “the response documents are updated” is extremely vague. Since that’s the part that’s causing whatever’s going wrong, you might want to provide more detail there.

Subject: ParentDocumentUnid breaks when document updated

Never say die thats me, I just kept experimenting.

Once the reponse documents have been created with the copytodatabase I also had to do:

Notesdocument.makeResponse(ParentDocument)

This does seem to have cured the problem, but I have to say I don’t exactly understand why its necessary.

Sue

Subject: RE: ParentDocumentUnid breaks when document updated

Yo have to do this because when you copied the documents to the new database, the ParentDocumentUNID changed, so the reference is lost. By using Notesdocument.makeResponse(ParentDocument), you restablish the link.

Subject: Closing this Thread

Thanks to both of you for responding.

If the $Ref’s hadn’t been correct then I would probably have MakeResponse anyway. This just goes to show that you can’t believe what you see.

Oh, incidentally there is an error in the LotusScript Help. NotesItem.lastmodified is shown as being DATE only but it is in fact DateTime.

Sue

Subject: RE: Closing this Thread

It’s a mistake to raise a new issue when closing a thread. :slight_smile:

If you see an error in the Notes documentation, the best and most efficient way to get it corrected, is to click the Feedback link which appears on every help page. Someone looks at every one of those comments. If you state clearly what you see that’s wrong, why it’s wrong, and what the correct information is, it stands an excellent chance of getting corrected.