I have a standard form that I call from a browser (IE7), which has a submit button on it with the following commands: @Command([FileSave]); @Command([FileCloseWindow]);
When I call the form from the browser using the ?Openform command and press the submit button, the WebQuerySave event runs, but not the agent in it. I know the event runs, because when I rename the agent, Domino returns an error.
When I run the agent using the command ?OpenAgent it works fine, but somehow it does not want to be called from the WebQueryOpen or WebQuerySave events. The code in the agent is as follows:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set doc = db.CreateDocument
doc.Subject = "test"
doc.Form = "Memo"
Call doc.Save( True, True )
Print "<H1>test</H1>"
Does anybody have any idea on this - it’s driving me nuts.
Subject: WebQueryOpen and WebQuerySave agent doesn’t run
Do not have the WebQuerySave agent explicitly save the document (for example, by calling NotesDocument.Save) because an explicit save could cause incorrect results.
Subject: WebQueryOpen and WebQuerySave agent doesn’t run
Gerrit,
Also be aware that your “Set doc = db.CreateDocument” statement effectively wipes out all content that was in the form at the time of submission. This should be “Set doc = session.DocumentContext”.
Subject: RE: WebQueryOpen and WebQuerySave agent doesn’t run
Thanks guys
I’m not sure why CreateDocument would affect the document context, but I removed all that and just added the line Print {Hello world} to the agent. I still would not run.
I double-checked the runtime properties on the agent and they are set to ‘Agent List Selection’ and ‘None’ so that is fine. Also, contrary to what I said earlier, when I changed the name of the agent, the calling form did not display an error.
I tried changing the agent and form from an notes version 8 designer client, but no luck.
I also tried saving the document with a button with the JavaScript line “document.forms(0).submit()”, but it acts the same as the @Command([FileSave]); @Command([FileCloseWindow]); commands
Subject: Found it - WebQueryOpen and WebQuerySave agent doesn’t run
I replaced the design of the database with the standard R7 mail template and the WebQueryOpen and WebQueryClose events started working. The template I was using before was the web mail template.
Maybe it was missing a design element - how bizarre.