Invalid note id - a strange solution

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.

Subject: RE: invalid note id - a strange solution

I strongly suspect, if you change it back to a string variable now, it will still work. There was something else going on that also changed.

Subject: RE: invalid note id - a strange solution

Thanks Andre, i think you are right.

I changed it back and forth several times and the results were consistent, but indeed that doesn’t mean that this is the real cause of the problem.

Now i tried again and it worked with a string variable as well.

I found several server crashes during runs of this agent (in lsxldap.dll) so something else might be wrong there.

Subject: RE: invalid note id - a strange solution

Thanks Andre, i think you are right.

I changed it back and forth several times and the results were consistent, but indeed that doesn’t mean that this is the real cause of the problem.

Now i tried again and it worked with a string variable as well.

I found several server crashes during runs of this agent (in lsxldap.dll) so something else might be wrong there.