Wednesday, November 15, 2006

SNTT - Follow up to "Calling an agent using RunOnServer when saving a new document"

In my previous post I called doc.Save in the PostSave event to force the NoteID to update. This was so I could pass it to NotesAgent.RunOnServer. In the comments to that post David Bohlin suggested I run the agent code in QueryClose instead, with the understanding that the NoteID is populated by the time QueryClose executes.

I did some testing and that is not the case. Try this:
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
Msgbox Source.Document.NoteID, 0, "Queryclose NoteID"
End Sub
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at

In my testing the NoteID was always 0 for a new document. The only way I was ever able to get it to update the NoteID was to call Source.Document.Save.


No comments:

Post a Comment