Creating agent using LotusScript

When I attempt to create an agent it prompts message says that “You don’t have enough priveleges to run Java or LotusScript agents”.

I am administrator and have the full administrator rights. In spite of these I cannot run LotusScript agent.

So how can I fix this problem?

Subject: Creating agent using LotusScript

Check the restricted and unrestricted code fields in the relevant server document (security tab).

Subject: RE: Creating agent using LotusScript

Thanks for your reponse. I did just like you said and my agent is running now. But it is giving an error as “Error creating product object”.

The code is below if you have a time please check it where I am wrong.

Sub Initialize

Dim ws As New notesuiworkspace

Dim uidoc As notesuidocument

Dim doc  As notesdocument

Dim view, view1,view2  As notesview

Dim db As notesdatabase

Dim ss As New notessession

Dim rtitem As NotesRichTextItem



Set db=ss.currentdatabase

Set view=db.getview("konfkalite")

Set doc=view.getfirstdocument()



While Not doc Is Nothing

	If Cstr(doc.tarih(0))=Cstr(Today) Then

	Set rtitem = New NotesRichTextItem( SendDoc, "Body" )

		'Set Senddoc = view.GetFirstDocument

	Call rtitem.AppendDocLink ( doc, doc.Subject( 0 ) & " in " & view.Name )

	doc.Subject = "İstediğiniz döküman"

	doc.SendTo = "Ozcan Arslan"

	doc.Body="Bugün girilen bir kayıt" 

	Call rtitem.AddNewLine( 1 )

	Call doc.Send( False )

Else

	doc.Subject = "İstediğiniz döküman yok"

	doc.SendTo = "Ozcan Arslan"

	doc.Body="Bugün girilmiş bir kayıt bulunmamaktadır" 

	Call rtitem.AddNewLine( 1 )

	Call doc.Send( False )

End If

	Set doc=view.getnextdocument(doc)

Wend

End Sub

Subject: I see at least 5 things wrong with your code.

First if this is a background agent the NotesUIDocument is not a valid declaration.Second your line Dim view, view1, view2 as NotesView does not make view a NotesView, only a Variant. You must declare it as Dim view As NotesView, view1 As NotesView, view2 As NotesView.

Next inside your loop

While Not doc Is Nothing

If Cstr(doc.tarih(0))=Cstr(Today) Then

	Set rtitem = New NotesRichTextItem( SendDoc, "Body" ) 'SendDoc is not declared or created

		'Set Senddoc = view.GetFirstDocument

	Call rtitem.AppendDocLink ( doc, doc.Subject( 0 ) & " in " & view.Name )

	doc.Subject = "İstediğiniz döküman"

	doc.SendTo = "Ozcan Arslan"

	doc.Body="Bugün girilen bir kayıt" ' Now you are overwriting any thing in your RTItem by creating a text item named Body on the doc

	Call rtitem.AddNewLine( 1 ) 'does not exist see above

	Call doc.Send( False )

Else

	doc.Subject = "İstediğiniz döküman yok"

	doc.SendTo = "Ozcan Arslan"

	doc.Body="Bugün girilmiş bir kayıt bulunmamaktadır" 

	Call rtitem.AddNewLine( 1 ) ' rtitem is not created in this part of the If statement

	Call doc.Send( False )

End If

Set doc=view.getnextdocument(doc)

Wend

Subject: RE: Creating agent using LotusScript

That error message doesn’t make sense to me, but you might want to code with “Option Declare” set, and use the debugger – for example, I can’t see “senddoc” declared or set anywhere.

Subject: Creating agent using LotusScript

If you would like ot learn more bout Agent Security, agent troubleshooting, agent good practices the following is a good resource:

http://www-10.lotus.com/ldd/46dom.nsf/7e6c7e584a76331b85256a46006f083e/574c99ccb345839185256976004e811e?OpenDocument