Hi all
I am hoping someone could help me out.
I am trying to create an agent that run's on a certain view, which will check values on a document and if the values are different it need's to update my history and update the field to the new price.
All is working great on the agent if i run it manually, but as soon as i switch it over to run on schedule nothing happens. And yes i did check on the server to see if there is any errors and there is nothing and can also see it did run with a certain amount of ticks.
This is my current code. And if someone could please assist it would be great.
Sub Initialize
Dim view As NotesView
Dim doc As NotesDocument
Dim s As New NotesSession
Set db = s.CurrentDatabase
Dim Retail1LHis As Variant
Dim TotalRetailP As Variant
Dim Product As Variant
Dim item As NotesItem
Dim statement As String
Set view = db.GetView( "Price list" )
'// loop thru all docs in Price list view.
Set doc = view.GetFirstDocument
If doc.HasItem("Retail1LHis") Then
While Not(doc Is Nothing)
new_value = doc.GetItemValue( "Retail1LHis" )
new_value1 = doc.GetItemValue( "TotalRetailP" )
Product1 = doc.GetItemValue( "Product" )
If new_value(0) = new_value1(0) Then
Else
statement = +"On"++" "+Cstr(Now) + " - " + +"The Retail Price of" +" "++Product1(0)+" "+"1L changed from"+" "+Cstr(new_value(0))+" "++"to"+" "+ Cstr(new_value1(0)) +" "+" - " + "Document changed by" +" "+ s.CommonUserName
Set item = doc.GetFirstItem("History")
Call item.AppendToTextList(statement)
Call doc.ReplaceItemValue( "Retail1LHis", new_value1(0))
Call doc.Save( False, True )
End If
Set doc = view.GetNextDocument(doc)
Wend
End If
End Sub
Kind Regards