Agent to modify few field

I need to change my year field to 2006 and my status field to active. I know how to do this via simple formula by using 2 agents, however, I will like to create just one agent. after changing this two field value, I will like to do document refresh. I hope someone is willing to spend some time sharing this formula.tqvm.

Subject: Agent to modify few field

try this code in an agent

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Set db = session.CurrentDatabase

Dim view As NotesView

Set view=db.GetView(yourviewname)





Set doc =view.GetFirstDocument

While Not doc Is Nothing

doc.year=2006

doc.status=“Active”

	success = doc.ComputeWithForm( False, False )

	If success Then

		Call doc.Save( True, True )

	End If

	Set doc=view.GetNextDocument(doc)

Wend