Hello,
I have created a scheduled simple agent to forward some forms with a specific conditions, the form is from “test” and it must have a field (state) that it contains “adjunto”. That simple agent works fine, but I have made this agent with lotusscript but it doesn´t work, and i don´t know why.
This is my scheduled code:
Option Public
Option Declare
Use “Solicitudes”
’
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim ns As NotesSession
Dim uidoc As NotesUIDocument
Dim ws As NotesUIWorkspace
Dim Col As NotesDocumentCollection
Dim form As NotesForm
Dim calculo As String
dim forward As NotesUIDocument
’
%REM
Sub Initialize
Description: Comments for Sub
%END REM
Sub Initialize
'
Set ns = New NotesSession
Set ws = New NotesUIWorkspace
Set uidoc = ws.Currentdocument
Set db = ns.Currentdatabase
Set form = db.Getform("TestDevelop")
'
On Error resume Next
'
Dim dateobj As New NotesDateTime("")
'
'@Adjust( fecha-hora ; años ; meses ; días ; horas ; minutos ; segundos ; [ DST ] )
'
calculo = "(@Adjust(FechaSolicitud; 0; 0; 0; 0; 0; 0)<= @Today) & (Form = ""TestDevelop"") & (Estado = ""Adjunto"") "
'
Print "hay " + CStr(col.count) + "documentos"
Set col = db.Search(calculo, Nothing, 0)
'
If col.Count > 0 Then
Set doc = col.Getfirstdocument
While doc Is Nothing
Call uidoc.Forward
'
Set forward = ws.CurrentDocument
Set doc = forward.Document
'
Call forward.FieldSetText( "EnterSendTo", "an email")
Call forward.FieldSetText( "Subject", "a string")
Call forward.Send
'
Set doc = col.GetNextDocument(doc)
Wend
Else
Print "No hay documentos"
End If
End Sub
Any suggets?