The code below works if I run it via the client. If I try to run this over the web it bombs. I was attempting to call the agent via the webqueryopen, but it does not work. The code is supposed to set NTuser field to the current NT user. AS mentioned it works fine via the client. I thought that it was permissions but the agent allows me to set the field to any text that I want, but not the NT user. I am new to script and appreciate any help thanks.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim mydoc As NotesDocument
Dim NTuser As String
Set db = session.CurrentDatabase
Set mydoc = session.DocumentContext
'Declare a string long enough to pass to the DLL
Dim username As String*255
Dim finalusername As String
Dim returnval As Long
'The functions 1 if successful
returnval=getusername(username,Len(username))
'Strip out the null characters
finalusername=Left(username,Instr(username,Chr$(0))-1)
mydoc.NTuser=finalusername
'Save the changes
mydoc.Save False, False
End Sub