Uidoc save crashing Notes

Hello,

I have a bit of code in an action button on an embedded view in a form.

The action button acts on the document selected in the embedded view. Basically, it needs to change a flag in the selected document and then also update the parent which is the current uidoc.

We used all backend processing before in this code but if the user then did anything else to the open document, it created a replication and save conflict.

We are trying ui stuff which is stopping the conflict, but, I cannot call uidoc save. Can anyone see why this would makeit crash?

Dim s As New NotesSession

Dim db As NotesDatabase

Dim docs As NotesDocumentCollection

Dim doc As NotesDocument

Dim ws As New notesuiworkspace

Dim Parentdoc As NotesDocument

Dim uiParentdoc As NotesuiDocument

Set db = s.CurrentDatabase

Set docs = db.UnprocessedDocuments

'Bail if they havent selected anything.

If docs.Count = 0 Then Exit Sub

Set doc = docs.GetFirstDocument

Do Until doc Is Nothing

Set uiparentdoc = ws.CurrentDocument

Set parentdoc=uiparentdoc.document

If doc.Form(0) = “CD” And (doc.kwCommType(0) = “eMail In” Or doc.kwCommType(0) = “Fax In” Or doc.kwCommType(0) = “File Note” Or doc.kwCommType(0)=“Phone Message”) And doc.rbDiaryStatus(0) >< “Actioned” Then

doccounter= uiparentdoc.FieldgetText(“nudoccounter”)

If uiparentdoc.EditMode=False Then uiparentdoc.EditMode=True

If doccounter>0 Then

doccounter=doccounter-1

Call uiparentdoc.FieldSetText(“nudoccounter”,Str(doccounter))

End If

doc.rbdiarystatus=“Actioned”

Call doc.save(True, False)


Call uiparentdoc.Save 'THIS CAUSES THE CRASH


End If

Set doc = docs.GetNextDocument( doc )

Loop

End Sub

Subject: Where else do you have LotusScript code?

You are using generic variables. If you are using the same variables in the parent doc, which is open, or the child doc using QueryOpenDocument event of embedded view, you may find a conflict of scope which would cause the crash.