Q
Problem solve Get help with specific problems with your technologies, process and projects.

Set a value in a field existing in another Lotus Notes database

Learn the LotusScript code you'll need to use to set a value in a Lotus Notes field that resides in a different Lotus Notes database.

How do I set a value in a field that resides in a different Lotus Notes database?

To set a field on a document in another Lotus Notes database, you must create LotusScript or Java code for that specific Lotus Notes database object. Ideally, the code will locate the Lotus Notes document -- using a view lookup, full-text search, or by the Unique Notes Identification Number (UNID) -- and then update its value on that Lotus Notes document. Remember to save the Lotus Notes document after updating the field, or the changes will not be saved.

Your code should look something like this:

Dim session As New NotesSession
Dim dbTarget As NotesDatabase
Dim docTarget As NotesDocument

Set dbTarget = session.GetDatabase
("Server", "filename.nsf")
If (dbTarget.IsOpen) Then
Set docTarget = dbTarget.GetDocumentByUNID
("document UNID")
If Not (docTarget Is Nothing) Then
Call docTarget.ReplaceItemValue
("field_name", "new_value")
Call docTarget.Save (True, False)
End If
End If

Do you have comments on this Ask the Expert Q&A? Let us know.

Related information from SearchDomino.com:

Dig Deeper on LotusScript

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com 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

SearchDataCenter

SearchContentManagement

Close