When the users does a form submit( save action) from the web this agent is triggered. But when I make changes through a background agent on documents this agent is NOT triggered. I was under the assumption that changes made in the background is also triggering this agent.
What must I changes to make sure that this agent is triggered when the user does a submit from the UI and when another background agent makes changes in the background?
Subject: RE: Agent is not triggered when changes are made through the background
Hi
I have tried the code to run the agent on server before and also after the doc save action. In both case I receive an error message where the second agent tries to find the document with the lotusscript code: Set contDoc = Session.DocumentContext
The second agent cannot find the document the first agent has changed and saved.
Must I also change the second agent? I’d rather not because the agent performs perfectly and its a complex agent.
Subject: RE: Agent is not triggered when changes are made through the background
documentcontext will not work in a background agent because of this little caveat from the designer help:
For an agent activated in a view through the Notes client UI, the in-memory document is the document highlighted in the view.
Since by its very definition a background agent has no UI, you are going to get an error when you try to set the document object via the documentcontext method of the NotesSession.
Instead of using DocumentContext, you will probably need to get a handle on the NoteID or UNID of the saved document and use that to get a handle on the doc in your second agent. Although I am not sure how you would pass a parameter to something like an initialize event, so you would either need to create a custom sub or function in your second agent, or create a custom class with a sub or function that accepts parameters.
if we could see the code, we could be a better help.