Response document looses $REF

I have a Response document that is sent to a PDF server (ePDF Server) after the user clicks an Action on the Form. Because the ePDF Server cannot properly process response documents the $REF field must be removed prior to sending and reattached (using MakeResponse) after sending.

The Action calls a LotusScript Agent with the following code fragments:

:

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim parent As NotesDocument

Dim item As NotesItem

:

If Not uidoc.EditMode Then

uidoc.EditMode = True

End If

Call uidoc.Save()

If doc.IsResponse Then

Dim parent As NotesDocument

Set parent = doc.ParentDatabase.GetDocumentByUNID(doc.ParentDocumentUNID)

Set item = doc.GetFirstItem(“$REF”)

Call item.Remove() ’ ePDF Server does not accept response docs

Call doc.Send(False)

Call doc.MakeResponse(parent)

Else

Call doc.Send(False)

End If

Call doc.Save(False, True, True)

Call uidoc.Save()

:

This code works in most cases (several douzend times a day). However, in a very few cases the document looses its $REF field and I have no idea how this can happen.

Let me know if you have any idea what could cause this problem.

The code fragment shows any Save, Remove and Send mathods that are used in the code.

Peter

Subject: Response document looses $REF

I would not modify the original document.

Create a new document, copy all items from your original, delete $Ref, send it, and don’t save it into the database.