LotusScript question--an easy one

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

Subject: LotusScript question–an easy one

add the line:

Call doc.save(true, false)

after this line:

doc.Notify = “Notified”

Subject: RE: LotusScript question–an easy one

Of course, I totally forgot about saving the change.

Thanks for the quick response, sorry for the stupid question.

Subject: RE: LotusScript question–an easy one

… whilst also removing the first save. There’s no point in saving a NotesDocument more than once in a given routine.

Subject: RE: LotusScript question–an easy one

Thanks for the suggestion, I guess that is why I overlooked saving the doc after the changes because I had already saved it after the refresh.

Thanks to the both you.

Subject: LotusScript question–an easy one

Kelly,The last part where you have:

doc.Notify = “Notified”

Set doc = tempdoc

Should read:

doc.Notify = “Notified”

’ You have to save the document before you go and process the next one.

Call doc.save(True, False)

Set doc = tempdoc

Regards