Lotus Agent errors

15 pts.
Tags:
Lotus Agents
Lotus development
Lotus error messages
LotusScript
Hello, I planned an agent with the following code: Sub Initialize Dim session As New NotesSession Dim view As NotesView Dim doc As NotesDocument Dim db As NotesDataBase Dim nowD As NotesDateTime Dim creatD As NotesDateTime Set db = session.currentdatabase Set view = db.getview("VueTout") Set doc = view.getfirstdocument Set nowD = New NotesDateTime("Today") view.autoupdate = False Do While (Not doc Is Nothing) Set creatD = New NotesdateTime(doc.GetFirstItem("Date").text) difference = nowD.TimeDifference(creatD) If (difference / 86400) > 60 Then Call doc.ReplaceItemValue("Statut", "Archive") Call doc.Save(True, True) End If Set doc = view.getnextdocument(doc) Loop view.autoupdate = True End Sub In manual mode it runs very well but if i run it in planned mode, it returns me the following error in the log file: AMGR: 'error to the agent ( "DuréeViePA" of "**** PetitAnnonc.nsf"): Date value not initialized I hope you understand me and so you can help me :) Please excuse my english, I'm french :)
ASKED: October 17, 2008  6:50 AM
UPDATED: November 5, 2008  1:04 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

The problems seems to indicate one of the date fields is not being filed. I would suggest using agent logging and error checking to find the problem.

This code will show the line and actual error, it should help. Take a look at agent logs for the future.

On Error Goto ErrorHandler

Set db = session.currentdatabase
Set view = db.getview(“VueTout”)
Set doc = view.getfirstdocument
Set nowD = New NotesDateTime(“Today”)

view.autoupdate = False

Do While (Not doc Is Nothing)
Set creatD = New NotesdateTime(doc.GetFirstItem(“Date”).text)
difference = nowD.TimeDifference(creatD)
If (difference / 86400) > 60 Then
Call doc.ReplaceItemValue(“Statut”, “Archive”)
Call doc.Save(True, True)
End If
Set doc = view.getnextdocument(doc)
Loop

view.autoupdate = True
exit sub

ErrorHandler:
ErrorMsg = “Error# ” & Err & | – | & Lsi_info(2) & ” called by ” & Lsi_info(12) & “(” & Lsi_info(430) & “): ” & Error$ & ” – Line: ” & Cstr(Erl)

print ErrorMsg
Resume Next

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Johnpob
    try this creatD = doc.Date(0) where you have the set creatD using date as a field name may not be wise
    15 pointsBadges:
    report
  • SAN67
    thank you but I found an other solution. I use this code :
    Sub Initialize
    	
    	Dim session As New NotesSession
    	Dim view As NotesView
    	Dim doc As NotesDocument
    	Dim db As NotesDataBase
    	
    	Set db = session.currentdatabase
    	Set view = db.getview("VuePurger")	
    	Set doc = view.getfirstdocument
    	
    	
    	view.autoupdate = False
    	
    	Do While (Not doc Is Nothing)
    		Call doc.ReplaceItemValue("Statut", "Archive")
    		Call doc.Save(True, True)
    		Set doc = view.getnextdocument(doc)
    	Loop
    	
    	view.autoupdate = True
    	
    End Sub
    in a view already sorted and it works perfectly.
    15 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following