LotusScript Agent - not running

Hi,

I have coded a validation agent which is called from a simple button on the webpage. Its purpose is to loop through the existing documents in a view and prompt if there is a document with the same ID. Here is the code :

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim viewdoc As NotesDocument

Dim UsedID As String

Dim coll As NotesDocumentCollection

Dim docAction As NotesDocument

Dim view As NotesView

Dim strPath As String

Dim strURL As String

Dim docMatrix As NotesDocument



Set db = session.CurrentDatabase

Set doc = session.DocumentContext

Set view = db.GetView("luIDs")

Set docMatrix = db.GetDocumentByUNID(doc.ParentDocumentUNID)

Set viewdoc = view.GetFirstDocument



Do Until viewdoc Is Nothing

	If viewdoc.NameID = doc.NameID Then

		'Do Nothing for the Moment

		Exit Sub

	End If

	Set viewdoc = view.GetNextDocument(viewdoc)

Loop



Call doc.Save(True, False)



strPath = ReplaceSubstring(db.FilePath, "\", "/")

strURL = "/" + strPath + "/Matrices/" + Trim$(docMatrix.UniversalID) +"?OpenDocument"

Print "[" + strURL + "]"

End Sub

When i call it all it does is refresh the current page and doesn’t save or load the specified webpage.

Thanks for any help.

F1H

Subject: LotusScript Agent - not running

I would think it would error on the viewdoc.NameID = doc.NameID line …

At any rate, you should pop in some messageboxes and watch the server console while it executes. That’s the easy way to troubleshoot these web agents.

regards,

raphael

Subject: LotusScript Agent - not running developments

Hi.

I have managed to get my agent running and its doing what it should. But my problem is how to load a page after it runs. Do i do it within the agent or back at the QueryWEbSave event? (because what i have in the agent strURL et doesnt work!

Thanks for any help

F1H

Subject: LotusScript Agent - not running

How are you calling the agent? documentContext will only work in the way you want if your button has @command([ToolsRunMacro];“myAgent”) to call the agent.

Perhaps the doc doesn’t point to the web document…

Subject: RE: LotusScript Agent - not running

Hi,

Thanks for your replies. I am running the agent by @command([ToolsRunMacro]). I have found out it is running, bacause the server log has the following error :

01/11/2006 13:20:55 Agent ‘ID Validation’ error: Invalid universal id

Any ideas?

Thanks

F1H