Lotus Script Agent on Web

Hi Folks,

I wish if you could help. The submit button on the form sets couple of fields on the form and changes the status. However the requirement is I have to put an event log on the form, I tried with LS agent in the webquerysave, @command([runtoolmacro];Agenttype). Keeping the LS agent as a variable in the javascript. But No help. Can any of you help me with the process of creating Auditlog on web.

The LS script I am using is

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Dim session As New NotesSession

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim item As NotesItem

Dim nam As NotesName

Dim user As String

Set uidoc = workspace.currentDocument

Set doc = uidoc.Document

Set nam = session.CreateName(session.UserName)

user = nam.Abbreviated



fldvalue=doc.GetItemValue("ln")

elements=Ubound(fldvalue)

If fldvalue(0) = "" Then

	SN = 0

Else

	SN=Cint(fldvalue(elements))

End If



Set item=doc.GetFirstItem("ln")

Call item.Appendtotextlist(Cstr(SN+1))



Set item = doc.GetFirstItem("LogAction")	

Call item.AppendtoTextList(Chr(13))

Call item.AppendtoTextList("Saved")	



Set item = doc.GetFirstItem("LogDate")

Call item.AppendtoTextList(Chr(13))

Call item.AppendtoTextList(Cstr(Now))



Set item = doc.GetFirstItem("LogBy")

Call item.AppendtoTextList(Chr(13))

Call item.AppendtoTextList(user)



Call uidoc.Save

End Sub

cheers

Raj

Subject: Lotus Script Agent on Web

Raj,

Why are you keeping the agent name dynamic?

Besides that… set your NotesDocument like this…

doc = session.DocumentContext

No UI stuff in the WEB!

Subject: RE: Lotus Script Agent on Web

Thanks Irvying,

However, it gives script error with session.context

It should be fine to use the agent as in the webquery save of the form. Could you please elaborate the code.

Thanks

Raj