Problems running a LS agent from the web

I am trying to have the following agent run as a querywebsave agent, but when I do nothing happens (document does not get saved and the agent does not run). I don’t even get the ‘Document Processed’ message, it just goes to the default webpage for the application. I have done this a zillion times but I cannot figure out WHY it is not working this time!!! Help…And I know it has something to do with the agent because ifI don’t call it from the webquerysave, the document gets saved.

Form has 2 fields, lastname and netid (simplified to the barebones to try to resolve this issue) and submit button with a filesave and fileclosewindow command

agent = welcome

trigger = action menu selection

webquery save on the form has @Command([ToolsRunMacro]; “welcome”)

And the agent looks like this

Sub Initialize

Dim s As New NotesSession

Dim memo As NotesDocument

Dim note As NotesDocument

Dim db As NotesDatabase                       

Set db = s.CurrentDatabase

Set note = s.DocumentContext

Set memo = New Notesdocument(db)

If note.netid(0) <> "" Then

	memo.Form = "Memo"

	memo.Principal="xxxx@uic.edu@NotesDomain"

            memo.SendTo = note.netid(0)

	memo.MailOptions = "1"

	memo.Subject =  "Welcome to UIC's FaCT Computer Program "

	tmpstring = "Hello, " + note.lastname(0)

	

	paragraph1 = "      paragraph1"

	paragraph2 = "paragraph2"

	paragraph3 = "paragraph3"

	paragraph4 = "paragraph4"

	paragraph5 = "Thank you"

	paragraph6 = "--- xxxx@uic.edu"

	paragraph7 = "    http://myurl"

	

	Set memobody = memo.CreateRichTextItem("Body")

	Call memobody.AppendText(tmpstring)

	Call memobody.Addnewline(2)		

	Call memobody.AppendText(paragraph1)        

	Call memobody.Addnewline(2)

	Call memobody.AppendText(paragraph2)

	Call memobody.Addnewline(2)

	Call memobody.AppendText(paragraph3)      

	Call memobody.Addnewline(2)

	Call memobody.AppendText(paragraph4)        

	Call memobody.Addnewline(2)

	Call memobody.AppendText(paragraph5)

	Call memobody.Addnewline(2)

	Call memobody.AppendText(paragraph6)

	Call memobody.Addnewline(2)

	Call memobody.AppendText(paragraph7)

	Call memo.Send(False)

End If



note.newfaculty="no"

Call note.save (False,False)   

End Sub

The agent runs fine if I run it against an existing document in the DB from the actions menu.

What am I doing wrong? This is driving me crazy!

Thank you in advance

Cynthia

Subject: Problems running a LS agent from the web

Save a document, and then check the agent log to see if it NEVER runs… or if it runs and fails…

Subject: Problems running a LS agent from the web

Check the server log for errors, better still, include an error handler in your sub.

Subject: RE: Problems running a LS agent from the web

There are no errors. nothing. document does not get saved, agent does not run. As I said, if I run the agent against a document that I already have saved, it runs fine…

Cynthia

Subject: RE: Problems running a LS agent from the web

A few suggestions.

  1. Check for the presence of a SaveOptions field in your form and if it is set to “0”.

  2. You should declare variables before using them. Most of your variables are not declared.

  3. Check if you are calling the correct agent in your WebQuerySave event.

  4. Sprinkle print statements in your code for the purpose of debugging.

  5. If it still does not work, remove the bulk of your code from your agent and see if the document saves. I would go as far as just instantiating the document object and then saving it. If it does, then I would put back the rest of the code, one line at a time or block by block.

Subject: Problems running a LS agent from the web

Possibly the agent signer does not have the privilege to run agents on the server? Also, standard advice is that the webquerysave() agent should not save() the context document. But I have not had problems doing so. In this case, since it is the last statement, it is certainly unnecessary.