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.

Enjoy!


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)
Next

End Sub

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close