
This agent is great in just about any database. What it does is run against any document, and it will give you a list of fields. Pick a field, and it will give you a prompt with the current data in the field. Replace the data and save. Perfect for those hidden fields, and all those other things you usually write a quick simple agent for.
Downside is that in its current implementation, it only works with text and on R5. It should be easy enough to add code to convert dates, number fields, etc. Just never got around to it myself. So, if anyone gets around to it, I'll post your results back here!
Sub Initialize
Dim workspace As New NotesUIWorkspace
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim fieldList() As String
Dim counter As Integer
Dim fieldToChange As String, newValue As String, value As String
Dim curval As Variant
Set db=session.currentdatabase
Set doc=session.documentcontext
counter=0
Forall i In doc.items
Redim Preserve fieldlist(counter)
fieldList(counter)=i.name
counter=counter+1
End Forall
fieldToChange$ = workspace.Prompt( PROMPT_OKCANCELLIST, "Choose Field to Change", "Choose Field to Change", "", fieldList)
Set curval = doc.getfirstitem(fieldToChange$)
value = Cstr(curval.values(0))
newValue = workspace.Prompt( PROMPT_OKCANCELEDIT, "Enter New Value", "Enter New Value", value)
Call doc.replaceItemValue (fieldToChange, newValue)
Call doc.save(True, True)
End Sub
Update: Erik Sorenson sent this link to code he created which handles all field types! Thanks Erik!