Database Script PostOpen [ToolsRunMacro] not working

Have code in the Database Script PostOpen event that works @ 5.0.10. It does not work @ 6.5. The line that is not working follows:

@PostCommand([ToolsRunMacro]:“(Agent)”)

Have placed msgbox at the first line of script. Get the message in 5.0.10 but not at 6.5. Have isolated this line by removing all other commands and functions in the PostOpen event. The agent is shared; Manual From Agent List;Run Once(@Commands may be used).

Any help would be appreciated.

Subject: Database Script PostOpen [ToolsRunMacro] not working

Sorry for the incorrectly typing. Code shuold say @PostedCommand([ToolsRunMacro]:“(Agent)”)

Subject: Solution

Hi James,

This is a really bad bug since R6!

If you open a database by an action out of an other database notes SOMETIMES keeps a reference to the calling database in the PostOpen event. In your case the Notes client runs the [ToolsRunMacro] command on the calling database! That means it tries to load the agent from the wrong database.

The bug apears only under special conditions. What I found out is:

  1. It only happens if you use FORMULA code in the PostOpen event! If possible change to LotusScript and use Call db.GetAgent(“myagent”).run instaed of [ToolsRunMacro]. This would not be possible in every case (because of UI functions in the agent you want to call).

  2. Look at the launching options of the database. If a complex frameset is opened (computed contents) you will get the error. Change to ‘restore as last viewed by user’ and your agent will be started.

The reason seems to be that at first the frameset is loaded (not displayed) then the code in PostOpen is executed (before any view is opened) and after that the view is loaded and displayed. So at execution time of PostOpen the client has not got a UI reference of the database being opened yet. The only opened database object ist the calling database. This is really crazy!

  1. In Notes 5 this effect will not apear. So alternatively you can downgrade your clients :wink:

I hope that will help you.

Bert

http://www.nappz.de