Subject: Here’s how to do what you want to do.
My solution, which you referenced, is for situations where the client is still waiting for the RunOnServer to complete even thought it’s already finished. As you already realized, implementing it does nothing but give you what you already have (albeit more reliably.)
In any case, the answer you’re looking for is called NotesSession.SendConsoleCommand. What you’re going to do is send a console command to execute the update agent. You do this from an agent that I usually refer to as a kicker agent (kicks off the process.) You must use the kicker because the agent that executes the SendConsoleCommand must have administrative rights to the server.
Create an agent that calls this method to start your update agent. Call it UpdateKicker. It will contain two lines of code:
Dim Nsess as New NotesSession
Nsess.SendConsoleCommand( |tell amgr run “apps/mydb.nsf” ‘UpdateAgent’| ) '(<-edited 11/10/07 to remove double quote before tell.)
On the Security tab for this agent, enter a name into the "Run on behalf of " field. Make sure this user has administrative access to the server. Also, make sure the SIGNER of the agent is listed in the server’s “Sign agents to run on behalf of someone else:” field under the security tab of the server configuration document. Okay you’re done.
In your PostSave execute the UpdateKicker
(note: I’m writing on the fly so commands may not be exact. consider it pseudo code.)
Dim Nsess as New NotesSession
Dim KickerAgent as NotesAgent
Set ThisDB = NotesSession.CurrentDatabase
Set KickerAgent = ThisDB.GetAgent( “UpdateKicker” )
Call KickerAgent.Run 'Note: Don’t need RunOnServer here
Here’s how it works.
You get a handle to the kicker agent and execute it.
Even though you are executing the agent, it runs with the rights of the user listed in the “Run on behalf of”
The agent sends the console command and ends. Control returns to the client.
Meanwhile, the agent that was kicked off by the console command is now running.
You didn’t say whether your agent is executed by a single person, or may be executed by several people at the same time. If the agent might be executed by several people at the same time, then you have to design your update process to be aware of that. You may want to review the Designer help documents on running agents asynchonously.
Good Luck!