Profile document saves automatically

I am seeing this strange behaviour. When I fetch a value from a profile document in the QuerySave event of a form, then change the value of the profile document, but never explicitly asks it to save the profile document, it seems that the profile document get saved anyway. Can anyone explain this?

In the example below, when I am working on an form which status field value is “Invoice” then it does save the profile document although it shouldn’t.

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim session As New NotesSession

Dim profile As notesdocument

’ set the invoice no

Set profile = source.document.ParentDatabase.GetProfileDocument(“SystemProfile”)

If source.document.status(0) = “Order” Then

  source.document.orderno = profile.OrderNoCount(0)

  profile.OrderNoCount = profile.OrderNoCount(0) +1

  Call profile.save(False, False)

Elseif source.document.status(0) = “Invoice” Then

  source.document.invoiceno =  profile.InvoiceNoCount(0)

  profile.InvoiceNoCount = profile.InvoiceNoCount(0) +1

End If

End Sub

Subject: RE: Profile document saves automatically

I believe the profile document is not being saved, but cached. That’s what profile documents are famous for. If you exit and restart the Notes client I think you’ll find your “saved” changes have gone away.

Notes is working as designed.