I’ve just been fighting with an “invalid Note ID” error in a server-agent that was started from the client. After reading all stories from others who had this error, i coincidently found a (rather strange ) solution.
I had code like this in the calling agent on the client:
…
dim strNoteID as string
strNoteID=doc.NoteID
call MyAgent.RunOnServer(strNoteID)
…
and in the called agent on the server:
…
dim strNoteID as string
strNoteID=myAgent.ParameterDocID
db.getDocumentByID(strNoteID)
this didn’t work.
But it started to do something after i changed the code to:
…
call MyAgent.RunOnServer(doc.NoteID)
on the client, and in the server agent:
db.getDocumentByID(myAgent.ParameterDocID)
The help says that both NotesDocument.NoteID and the NoteID argument to NotesDatabase.GetDocumentByID are of type string but apparently they are not.
After converting the NoteID of a document to string is was “192”.
When i placed doc.NoteID in the first column of a view, doc.columnvalue(0) for the same document was “00000192”
But with view.getDocumentByKey, i could only find the document if i searched for “NT00000192”.
Later on i tried to store doc.NoteID in a variant… No problem at all.