This is a known issue but if you get it the first time it may confuse you.
Lotus script function CreateObject() does not work in NotesAgent if it was called using method RunOnServer. Of course database with the agent should be located on the server.
To see it yourself you can do next:
1) Create a scheduled agent. I suggest you to choose a schedule 'Never'. Do not forget to change agent's security level to 2 or 3. Put next lotus script there:
Sub Initialize
On Error GoTo errh
Dim db1C As variant
Set db1C = CreateObject("Scripting.FileSystemObject")
If IsObject(db1C) Then MsgBox "OLE Object is created" : Set db1C = nothing
basta:
Exit sub
errh:
MsgBox Error & " in line " & Erl
Resume basta
End Sub
2) Check that it works. You can do that from the Domino console (of course, if you have access to it)
tell amgr run "yourdatabase" 'agentname'
Okay, it works:
3) Then create a second agent with a lotus script like this
Sub Initialize
Dim s As New NotesSession
Dim agent As NotesAgent
Set agent = s.currentdatabase.getagent("name_of_your_agent")
Call agent.runonserver()
End Sub
4) Run the second agent a few times and you for sure will get this error in Domino console:
You got the error.
Fortunately, there is a workaround.
You have to create one more agent, move the call of CreateObject() there and invoke this 3rd agent using method NotesAgent.Run() from the agent that you invoked using method NotesAgent.RunOnServer().
The schema will look like on the screen below.
Of course, the first chain ( instead of agent 1) could be an action, a button etc.
There is a ticket on IBM where they confirmed this bug to be fixed in future releases:
http://www-01.ibm.com/support/docview.wss?uid=swg21088529.
I checked this case with release 9.0 (both Domino server and Notes client) - bug is still there :-)
No comments:
Post a Comment