Agent doesn't find a document by ParameterDocId

Dear All,

Please help me because I have been already confused…

I need an agent (on the server) that should find a document in own db. The agent is called by an action:

The action:


Set report = db.GetAgent(“Report”)

Set doc = db.CreateDocument '->it should be found by the agent

Call doc.Save(True,False)

Call report.RunOnServer(doc.UniversalID)


The agent:


Set agent = s.CurrentAgent

Set db = s.CurrentDatabase

Set rpdoc = db.GetDocumentByID(agent.ParameterDocID)

Messagebox agent.ParameterDocID

Messagebox "Form: " & rpdoc.Form(0)


I get this message:

2007.04.16 14:02:51 Agent message: 422DD8

2007.04.16 14:02:51 Agent ‘Report’ error: Object variable not set’

There is default view in the db.

What is the problem?

Regards

Tibor

Subject: Agent doesn’t find a document by ParameterDocId

You are passing the agent a universal id when it takes a note id.

Try

Call report.RunOnServer(doc.NoteId)

Subject: RE: Agent doesn’t find a document by ParameterDocId

Yes, I’ve tried but I get: Agent ‘Report’ error: Invalid note id:-(

Subject: RE: Agent doesn’t find a document by ParameterDocId

The error message indicates that it is unable to find a document with that id so is the server the agent runs on and the server the document is created on the same?

The notesid differs to the universalid in that documents which are replicas of each other will usually have a different notesid on different replicas of the database.

Subject: RE: Agent doesn’t find a document by ParameterDocId

yes,or use GetDocumentByUNID

Set doc = db.GetDocumentByUNID(agent.ParameterDocID)

in agent

Subject: Agent doesn’t find a document by ParameterDocId

  1. pass doc.NoteID not doc.UniversalID2) Use Set rpdoc = s.DocumentContext