I have an agent that runs on new and modified documents in a particular view. I want to assign a value to the field “Notify” so that that the agent only runs once, and so I know that the agent did run on that document.
I have tried a few different ways to get this to work but I am not able to assign the value.
Here is my agent:
Sub Initialize
Dim ses As New NotesSession
Dim doc As NotesDocument
Dim filename As String
Dim Filenum As Integer
Dim TimeNow As String
Dim dateTime As New NotesDateTime( "" )
Dim it As NotesItem
Dim db As notesdatabase
Dim view As notesview
Dim tempdoc As notesdocument
Dim dbdoc As Notesdocument
Set db = ses.currentdatabase
Set view = db.Getview("Export Coil")
Set doc = view.getfirstdocument
Do While Not doc Is Nothing
Call doc.computewithform(True, False)
Call doc.save(True, False)
Set tempdoc = view.getnextdocument(doc)
TLocation =doc.GetItemValue( "Location_1" )
TCoilNumber=doc.GetItemValue( "CoilNumber_1" )
TColorCode=doc.GetItemValue( "ColorCode_1" )
TCoilClass=doc.GetItemValue( "CoilClass_1" )
TMetalCost=doc.GetItemValue( "MetalCost_1" )
TDesc1=doc.GetItemValue( "Desc1_1" )
TDesc2=doc.GetItemValue( "Desc2_1" )
TCostCenter=doc.GetItemValue( "CostCenter_1" )
TCoilPointer=doc.GetItemValue( "CoilPointer_1" )
TTollingCost=doc.GetItemValue( "TollingCost_1" )
TScrap=doc.GetItemValue( "Scrap_1" )
TSpace=doc.GetItemValue( "Space" )
dateTime.LSLocalTime = Now
Filenum=Freefile
Filename="\\nt50a\Coil\"+Format(Now,"DDHHMMSS")+".txt"
Open FileName$ For Output As FileNum%
Print #FileNum%, TLocation(0) & TSpace(0) & TCoilNumber(0) & TSpace(0) TLocation(0) & TSpace(0) & TCoilNumber(0) & TSpace(0) & TColorCode(0) & TSpace(0) & TCoilClass(0) & TSpace(0) & TMetalCost(0) & TSpace(0) & TDesc1(0) & TSpace(0) & TDesc2(0) & TSpace(0) & TCostCenter(0) & TSpace(0) & TCoilPointer(0) & TSpace(0) & TTollingCost(0) & TSpace(0) & TScrap(0)
Close FileNum%
doc.Notify = "Notified"
Set doc = tempdoc
Loop
End Sub