Manage Learn to apply best practices and optimize your operations.

A Very Simple Mass Change Agent

This is a very simple and useful agent if you want to update a document field or add a new document field. It can be run against one document or a collection of documents. Create this agent once and copy it into any database.

Copy the code below into the Initialize subroutine.

Here is how it works:

First prompt: Enter Name of Field to Update

Second prompt: Enter new value to place in field

Third prompt: What Type of field is this?
The valid choices are: "Text", "Number", "Date" without the quotes. The default is text.


Sub Initialize

Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim field As NotesItem
Dim NewValue As Variant
Dim updatefield As String
Dim NewType As String

Set db = Session.CurrentDatabase
Set collection = db.UnprocessedDocuments

UpdateField = Inputbox$("Enter Name of field to update", "Mass Update")

NewValue = Inputbox$("Enter new value to place in field", "Mass Update")

NewType = Inputbox$("What Type of Field is this?", "Text Number Date", "Text")

Select Case NewType
Case "Text" : NewValue = NewValue
Case "Number" : NewValue = Val(NewValue)
Case "Date" : NewValue = Cdat ( NewValue )
Case Else : NewValue = NewValue
End Select

Dim x As Integer

For x = 1 To collection.Count
Set doc = collection.GetNthDocument(x)
Set field = doc.ReplaceItemValue(updatefield, newvalue)

Call doc.ComputeWithForm(True, False)
Call doc.Save(True, False)

End Sub

Dig Deeper on Lotus Notes Domino Administration Tools



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury